CPAN error message - cpan

I was trying to use my CPAN, but when I typed in the following command. The errors occurred. A similar question was asked in this forum(install CPAN module), I tried that solution, but it did not work for me. I am wondering if anyone can drop a hint?
perl -MCPAN -e shell
Your configuration suggests that CPAN.pm should use a working
directory of
/home/bq/.cpan Unfortunately we could not create the lock file
/home/bq/.cpan/.lock due to 'Permission denied'.
Please make sure that the configuration variable
$CPAN::Config->{cpan_home} points to a directory where you can write a .lock file. You can set this variable in either a
CPAN/MyConfig.pm or a CPAN/Config.pm in your #INC path;

Try:
sudo perl -MCPAN -e shell

This is an old question , but if anyone is still looking. Mine worked with changing the folder permissions for the folder the i wanted to use.So use chmod to change the folder permission and the modules will install as required.

Related

Perl Module install to mentioned directory

I want to install a Perl module to a particular directory which I am mentioning while executing a command.
I want this module to be installed in a mentioned path.
Command I tried is
$ env PERL_MM_OPT='INSTALL_BASE=/home/vinod/my_test_folder/perl_practice/scripts' cpanm Log::Log4perl
But this by default installed in /home/vinod/my_test_folder/perl_practice/scripts/lib/perl5.
What could be the reason? How to install the module in particular directory which I am mentioning?
See the documentation of INSTALL_BASE. You seem to be interested in changing just the INSTALLPRIVLIB path. Maybe you want to set the LIB attribute only, described in the next section?

how to change configuration of CPAN from local::lib to sudo preference

Hi am new to using perl and installed CPAN using the code:
$ perl -MCPAN -e shell
and i got the following prompt:
To install modules, you need to configure a local Perl library directory or escalate your privileges. CPAN can help you by bootstrapping the local::lib module or by configuring itself to use 'sudo' (if available). You may also resolve this problem manually if you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
I selected local::lib, but i realized that may not be the best for what I want to do and now would like to switch to sudo to build modules not in a local library. I have tried to build libraries but they always get put in a local library.
How would I do this?
Thanks
CPAN may store its configuration and the choice you made in several places, however, you should take a look first at /etc/perl/CPAN/Config.pm and/or $HOME/.cpan/CPAN/MyConfig.pm.
Deleting these file (you may move them as a backup if you're not sure) will reset CPAN to default behavior.
You may also have a look inside these files, find the exact parameter, and remove the corresponding line.
try grep local::lib ~/.cpan/CPAN/MyConfig.pm for example...
To disable local::lib and get the configuration prompt again you must remove:
PATH="/home/.../perl5/bin${PATH:+:${PATH}}";
export PATH;
PERL5LIB="/home/.../perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}";
export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/home/.../perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}";
export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/home/.../perl5\"";
export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/.../perl5";
export PERL_MM_OPT;
From ~/.bashrc

"Can't locate PgCommon.pm" when trying to uninstall Postgres server

I'm trying to remove postgres from my Ubuntu machine, but when I do, I'm getting the error message
Can't locate PgCommon.pm (#INC is [... a list of paths ...])
Any idea why PostgreSQL would lose track of a file it installed itself?
This can happen if you changed Perl interpreters since installing postgres. It can't find the package anymore because it was installed into a different modules directory. If this command
$ which perl
doesn't give this response
/usr/bin/perl
It's likely that you're just using the wrong Perl binary. In my case, I had symlinked /usr/local/bin/perl to my custom Perl binary (which my app needs in order to function) so I just renamed the symlink temporarily, ran apt-get remove postgres again, then put the symlink back where it was!

Why did "cpanm Email::Sender::Simple" change directory permissions for other modules, breaking bugzilla?

So I was working on a small Perl project and needed the Email::Sender::Simple module. I installed it, for some reason, via cpanm instead of cpan like I usually do:
cpanm Email::Sender::Simple
After installing the module, I checked my Bugzilla installation, and found that it was totally broken. The bugzilla homepage was just reporting an error. It wasn't able to find modules like Data::OptList, which wasn't on the #INC path.
I determined the problem was that the file permissions in /usr/local/share/perl/5.8.8 had been changed, with many directories now having permissions like this:
drwx------ 4 root root
That is, only root was allowed to look in the directory. Those directories need to be readable by my "www-data" user so that Bugzilla can find and use modules such as Data::OptList.
Bugzilla has a checksetup.pl script which often fixes file permission problems, but it did not fix or detect this problem.
I was able to get things working again via:
find /usr/local/share/perl/5.8.8 -type d -exec chmod 755 {} \;
After doing that, I'm back up and running. But I'm worried that other permissions might have been changed. And I can't understand why cpanm would be so bold, reconfiguring my file permissions.
Does anyone understand why cpanm would have altered permissions in /usr/local/share/perl/5.8.8 ? Might it have changed other things? Is there a way to prevent this from happening again? Is the "cpanm" command somehow different from "cpan" ?
Unlikely story :) http://search.cpan.org/grep?cpanid=MIYAGAWA&release=App-cpanminus-1.5007&string=chmod&i=1&n=1&C=0

Why does installing DBD::Pg fail in DynaLoader?

Error: Can't load '/home/oracle/.cpan/build/DBD-Pg-2.16.1/blib/arch/auto/DBD/Pg/Pg.so' for module DBD::Pg: libpq.so.5: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
Did anyone have similar error while instaling DBD::Pg perl module ? what can I do to fix it ?
You should go under perl to solve these dynamic linking problems. Use strace program &> out, and then grep for libpq.so.5. My guess is your libpq.so.5 is in the wrong location, or your DynaLoader is misconfigured. Read the docs on #dl_library_path.
You can see what your search path is with this (the strace will also show it trying to find the .so by checking each directory):
perl -MDynaLoader -le'print for #DynaLoader::dl_library_path;'
Make sure your libpq.5.so falls in one of those. The strace will also show if the kernel is returning an error to DynaLoader that it is cloaking; moreover, it will certainly tell you everything DynaLoader knows.
The libpq.so.5 file is missing, which indicates that you do not have the Postgresql client library installed. On Ubuntu this file is provided by the libpq5 package.
Make sure the path to the PostgreSQL library is in either ld.so.conf or in a file in ld.so.conf.d and re-run "sudo ldconf" (or sudo /sbin/ldconf). That's taken care of this issue when I've encountered it in the past.
I know lots of people have answered your question but I thought I'd add one more thing. Makefile.PL locates the postgres libraries by executing pg_config. If this can't be found on your path, then you will find this sort of error. Interestingly though, it looks for the headers in the same way. Try running pg_config from your terminal and see what the output is. If it's not found in your path, locate it, add to your path and try to build DBD::Pg again