Regarding perl 5.8.3 DBI installation - perl

Noticed our system has perl 5.8.3. I am unable to locate the DBI.pm. When i did perl -V it was showing the below output. Pasted it below. Using HPUX11 os. All installed files under the perl installation directory are having root or bin as owner of the file. I dont have root password now. I want to install DBI.pm. how can i do it. Do i need to download it from CPAN or Active Perl Website?
perl -V
Characteristics of this binary (from libperl): Compile-time options:
MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Locally applied patches:
ActivePerl Build 809
22218 Remove the caveat about detached threads crashing on Windows
22201 Avoid threads+win32 crash by freeing Perl interpreter slightly later
22169 Display 'out of memeory' errors using low-level I/O
22159 Upgrade to Time::Hires 1.55
22120 Make 'Configure -Dcf_by=...' work
22051 Upgrade to Time::HiRes 1.54
21540 Fix backward-compatibility issues in if.pm Built under hpux Compiled at May 17 2005 18:12:56
/opt/perl/lib/5.8.3/PA-RISC1.1-thread-multi
/opt/perl/lib/5.8.3
/opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi
/opt/perl/lib/site_perl/5.8.3
/opt/perl/lib/site_perl
All installed files under the perl installation directory are having root or bin as user id. I dont have root password now. I want to install DBI. How can i do it?

CPAN has an option local::lib which will install to ~/perl5. If that works for you, that's your best option, otherwise create a directory somewhere that you do have access (probably under your /home), download DBI.pm (and any dependencies) manually, and put it in there.
Then add the directory name to your PERLLIB environment variable (which is not set at the moment). Do perl -V to confirm that ~/perl5 has been added to #INC.

Related

Using local Perl module instead of one installed by CPAN

I have found it necessary to expand upon a CPAN module. (Unicode::CharName goes up to Unicode 4.1; I need some characters from Unicode 5.0 & 5.1).
I've made the changes needed and have my own CharName.pm module.
I now would like to use it with my various Perls. I currently use:
Strawberry Perl for Windows
git for Windows MINGW64; My .bashrc sets
$PATH to Strawberry perl and $PERL5LIB=/c/Strawberry/perl/vendor/lib:/c/Strawberry/perl/site/lib
WSL Ubuntu
Where should I put my version of Unicode::CharName, so that it over-rides the ones installed by CPAN?
I don't want to have to change any scripts that currently
use Unicode::CharName;
Using cpanm you could download the module, patch it, and install it as normal:
$ cpanm --look Unicode::CharName
# new shell opens
$ patch lib/Unicode/CharName.pm custom.patch # or whatever process
$ perl Makefile.PL
$ make install
$ exit
You can also install it to a local::lib to avoid overwriting it globally, by adding the -l local/ option to the cpanm command. Then you can add the absolute path of this local::lib to your PERL5LIB or via -I or use lib. If you specified /path/to/local for the -l option, it would be /path/to/local/lib/perl5.
Manually copying files rather than going through the normal installation process is likely to lead to problems. Many distributions depend on the installation process to build the modules correctly. Also, you will need to install the module separately for each Perl you want to use it for; installed Perl modules are not generally cross-compatible between Perl versions or architectures. (A strictly simple pure-Perl module can be an exception to these rules, but the only module I feel comfortable abusing this way is App::cpanminus, because it was designed to do this.)

"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!

CPAN 1.61 has issue with embedded space in path within Cygwin on Win7

I’m a mere mortal using Cygwin on Win7 and wanting to develop perl scripts using SOAP::lite. Installation instructions I found at soaplite.com directed me to start with perl –MCPAN –e shell before attempting an > install SOAP::lite
The newb in me didn’t appreciate that my windows user profile has a space character in it and the CPAN set-up seemed to go all horribly wrong around the point where the script was writing make files for local::lib, MYMETA.yml and MYYMETA.json. I got “no such file or directory” messages quoting only the portion of the path that followed the space in my user profile.
$ uname -a
CYGWIN_NT-6.1 UKLHRL00020 2.0.4(0.287/5/3) 2015-06-09 12:22 x86_64 Cygwin
$ cpan --version
Loading internal null logger. Install Log::Log4perl for logging messages
/usr/bin/cpan version 1.61 calling Getopt::Std::getopts (version 1.06 [paranoid]),
running under Perl version 5.14.4.
[Now continuing due to backward compatibility and excessive paranoia.
See ``perldoc Getopt::Std'' about $Getopt::Std::STANDARD_HELP_VERSION.]
Nothing to install!
When I ran perl –MCPAN –e shell for the first time, it did report “Warning: You do not have write permission for Perl library directories.” and I elected for the default option [local::lib] for the approach to be taken.
So what can I do next?
Looking closer at the Cygwin’s setup-x86_64.exe, a search for “cpan” lists eight packages under the perl category for perl-CPAN-* and perl-Parse-CPAN*, which are all set to “Skip”. The package perl-CPANMeta: Perl distribution CPAN-Meta is version 2.150001-1 from cygwin.mirrors.pair.com. Since this is not installed yet, but the installed Perl5 has some knowledge of an old CPAN, I need to know if it is safe to install the latest and will it work with a space in my profile? Do I need to remove the old CPAN, and how?
You probably want to update to the latest version of ExtUtils::MakeMaker, recent versions contain various fixes for paths containing spaces. This should fix these issues.

How to specify variables for module installations with cpan?

During installation with cpan (e.g. cpan XML:Parser) source code is compiled and sometimes requires additional variables to be set (in the example EXPATLIBPATH and EXPATINCPATH). cpan prints a helpful message what needs to be specified, but says that the specification needs to be ''Makefile'' argument/variables - when running cpan that doesn' add up.
I tried to specify environement variables with env (only INC is recognized for C includes, but the value is trimmed after the first space, so adding a -L directive doesn't work) and appending the variables which makes cpan search for modules with the variable name and argument. The manpage of cpan leaves this (quite crucial) matter completely uncovered. Setting LD_LIBRARY_PATH to the prefix I installed expat to doesn't work (header files isn't found).
If there's not a generic way, then I'd appreacite a solution for the cpan XML::Parser installation. I don't have root permissions on the system, so I need to specify the variables.
I use cpan 1.61 with perl 5.20.2 on Ubuntu 15.04 with Linux 4.0.1.
You can always do
install cpanm if you don't have it, with curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --look XML::Parser
That'll download the needed tarballs, unpack, and open a shell inside the distribution. So you're free to do:
perl Makefile.PL
make with any options you need (like setting EXPATLIBPATH)
make test
(sudo) make install

How do I stop cpan from reconfiguring each time? + More

I'm running on a Mac (version 10.6.3) and am struggling to understand what is going on with my Perl installation.
I let the system do a copy from my previous mac, and I appear to have a second perl installed, which appears earlier in my path. I can't tell (or remember) if I might have installed it with fink, macports or CPAN or what.
type -a cpan
cpan is /opt/local/bin/cpan
cpan is /usr/bin/cpan
I'm seeing two oddities. (To start with!) When I run cpan, and let it configure in ~lcuff/.cpan, each time I run it, it wants to reconfigure, giving the message:
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters...
Also, when I try to install File::Find::Rule (so I can list my CPAN modules, per the FAQ) I end up with an error message that I can't decipher or Google a solution for:
Use of inherited AUTOLOAD for non-method Digest::SHA::shaopen() is deprecated at /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Digest/SHA.pm line 55.
Catching error: "Can't locate auto/Digest/SHA/shaopen.al in \#INC (\#INC contains: /sw/lib/perl5 /sw/lib/perl5/darwin /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 /Users/lcuff) at /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Digest/SHA.pm line 55\cJ" at /opt/local/lib/perl5/5.8.9/CPAN.pm line 359
CPAN::shell() called at /opt/local/bin/cpan line 198
I just went through my first migration to a new Mac last week, including a switch from fink and system perl to MacPorts and custom perl, so I remember the pain all too well...
As Schwern said, /opt/local is the default install location for MacPorts; fink uses /sw.
I did encounter a similar problem with CPAN configuration, although I didn't make any attempt to determine whether it was repeatable or not.
The first time I ran CPAN config, it said that I had an existing CPAN dir at ~/.cpan and stored the configuration there.
The second time, it wanted to configure into an existing CPAN dir at ~/Library/Application Support/.cpan. I didn't feel like repeating the CPAN configuration, so I broke out, did a quick cd ~/Library/Application Support/.cpan ; rm -rf .cpan ; ln -s ~/.cpan ., and it's worked great for me since then.
Hopefully this will at least help get you pointed in the right direction.
Have a look at Perlbrew.
Perlbrew allows you to install and manage mulitple versions for Perl under your home directory at ~/perl5
Installation is easy:
curl -LO http://xrl.us/perlbrew
chmod +x perlbrew
./perlbrew install
and simply follow the instructions.
Been using it for past few months on Mac OSX and it worked like a charm!
/I3az/