perl module installation shared host - perl-module

My shared hosting is missing two Perl modules required by Amazon SES Scripts. They are:
Digest::SHA and XML::LibXML
I downloaded Digest::SHA from here and XML::LibXML from here
Extracted, and uploaded LibXML.pm and SHA.pm to my custome directory (my_perl_lib).
I have added:
use lib "/var/chroot/home/content/09/6758009/html/my_perl_lib";
to the second line to the perl script.
I get this:
Can't locate XML/LibXML.pm in #INC (#INC contains: /var/chroot/home/content/09/6758009
/html/my_perl_lib /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5
/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-
thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8
/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./ses-get-stats.pl line 24.
BEGIN failed--compilation aborted at ./ses-get-stats.pl line 24.
Please advise.
Updated:
thanks, i created the directory, the error gone, but i faced another one:
Can't locate loadable object for module XML::LibXML in #INC (#INC contains: /var/chroot
/home/content/09/6758009/html/my_perl_lib .......) at /var/chroot/home/content/09/6758009
/html/my_perl_lib/XML/LibXML.pm line 153 BEGIN failed--compilation aborted at /var/chroot
/home/content/09/6758009/html/my_perl_lib/XML/LibXML.pm line 153. Compilation failed in require
at ./ses-get-stats.pl line 24. BEGIN failed--compilation aborted at ./ses-get-stats.pl line 24.
Updated:
thanks again for your reply.
here are the results:
-bash-3.2$ perl Makefile.PL INSTALL_BASE=/var/chroot/home/content/09/6758009/html/my_perl_lib
enable native perl UTF8
running xml2-config...ok (2.6.26)
looking for -lxml2... no
looking for -llibxml2... no
libxml2 not found
Try setting LIBS and INC values on the command line
Or get libxml2 from
http://xmlsoft.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter
to see the exact reason why the detection of libxml2 installation
failed or why Makefile.PL was not able to compile a test program.
-bash-3.2$

It needs to be inside an "XML" directory... IE, make sure that LibXML.pm is actually in /var/chroot/home/content/09/6758009/html/my_perl_lib/XML/LibXML.pm.
Updated:
You probably need to do a full local install of the perl module, and the shared object that accompanies it. You can do this by using:
# extract sources
# cd source-directory
# perl Makefile.PL INSTALL_BASE=/var/chroot/home/content/09/6758009/html/my_perl_lib
# make
# make install
This will install everything needed into that directory. Then in the script, reference both of these paths:
use lib '/var/chroot/home/content/09/6758009/html/my_perl_lib/lib/perl5';
use lib '/var/chroot/home/content/09/6758009/html/my_perl_lib/lib/perl5/i386-linux-thread-multi/auto';
Note that you'll likely need to change the architecture of the i386-linux-thread-multi part of that line. That's where the .so file is installed.

Related

Perl: installing Alien::SVN fails with Base class package "Module::Build" is empty

Running the command cpan Alien::SVN fails with the following output
Base class package "Module::Build" is empty.
(Perhaps you need to 'use' the module which defines that package first,
or make that module available in #INC (#INC contains: inc /usr/local/Cellar/perl/5.24.1//lib/perl5/5.24.1/darwin-thread-multi-2level /usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1/darwin-thread-multi-2level /usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1 /usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1/darwin-thread-multi-2level /usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1 /usr/local/lib/perl5/site_perl/5.24.1/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.24.1 .).
at inc/My/SVN/Builder.pm line 5.
BEGIN failed--compilation aborted at inc/My/SVN/Builder.pm line 5.
Compilation failed in require at Build.PL line 6.
BEGIN failed--compilation aborted at Build.PL line 6.
Warning: No success on command[/usr/local/Cellar/perl/5.24.1/bin/perl Build.PL]
MSCHWERN/Alien-SVN-v1.8.11.0.tar.gz
/usr/local/Cellar/perl/5.24.1/bin/perl Build.PL -- NOT OK
Full output at https://gist.github.com/e072fc0785310f47c3ac1f201eb45d7b
Environment
OS: MacOS 10.10.5
Perl: 5.24.1
Cpan: 1.6.1
Perl is installed via homebrew.
I have also tried setting the following environment variables
export PERL5LIB=${PERL5LIB}:/usr/local/Cellar/perl/5.24.1//lib/perl5/5.24.1/darwin-thread-multi-2level
export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"

How to install Net::SSH2 from CPAN on Cygwin

I needed to install Net:SSH2 in a Cygwin environment under Windows 7 (64 bit). As usually I tried to install it with cpanm.
I already had the necessary Cygwin packages (see below) installed but the Perl build failed because it couldn't find the libssh2 library.
There is a special text file BUILDING.WIN32 in the Net::SSH2 package but this is only useful when building the module by hand and it refers mainly to MinGW. So this no help.
This is the log of the build:
Entering Net-SSH2-0.53
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.59 ... Yes (7.02)
Running Makefile.PL
Configuring Net-SSH2-0.53 ... Subroutine checklibs redefined at inc/Module/Install/CheckLib.pm line 11.
Subroutine assertlibs redefined at inc/Module/Install/CheckLib.pm line 25.
Subroutine _author_side redefined at inc/Module/Install/CheckLib.pm line 39.
The libssh2 library is required by this module. If you don't have it, you can
download it from http://www.libssh2.org; you may also need OpenSSL, which can
be obtained from http://www.openssl.org , or libgcrypt, which can be obtained
from http://www.gnupg.org .
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
You can pass your libssh2 lib and include dirs (and extra link args) on the
command line. E.g.:
perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include \
ldargs="-lz"
These can also be set through the LIBSSH2_LIB/LIBSSH2_INCLUDE/LIBSSH2_LDARGS
environment variables.
To build with libgcrypt instead of OpenSSL, pass 'gcrypt' as a parameter to
Makefile.PL, e.g.:
perl Makefile.PL gcrypt
If you want to build on Windows, see the file BUILDING.WIN32 in the
distribution.
Can't link/include C library 'ssh2', aborting.
First install the libssh2-devel package from Cygwin, e.g. with apt-cyg the command line frontend for installing packages from within a cygwin shell.
apt-cyg install libssh2-devel
Then set some environment variables to the right path for getting Net::SSH2 to work with the Cygwin packages:
LIBSSH2_LIB=/usr/lib/ LIBSSH2_INCLUDE=/usr/include/ cpanm -v Net::SSH2
That worked for me. Much easier than what the readme file linked above looked like.

Why doesn't LWP.pm work on Mac OSX?

I have a Mac Book Pro, it has Perl.
I have a script with includes.
use LWP ;
use HTTP::Request::Common qw{ POST };
use HTML::Form;
LWP so I ran (twice once as root once as normal user) Guide I followed
perl -MCPAN -e 'shell'
install Bundle::LWP
install HTML::Tree
install HTML::Form
Warning: Cannot install HTML::Format, don't know what it is.
It says its missing two dependencies, but when I install them it says they are already done...?
Pastebin showing the output of the dependencies problem
When I run the script this is the error I get:
Can't locate LWP.pm in #INC (#INC contains: /opt/local/lib/perl5/site_perl/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.16.3 /opt/local/lib/perl5/vendor_perl/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.16.3 /opt/local/lib/perl5/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/5.16.3 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl .) at NMLRegAttack2.pl line 1.
BEGIN failed--compilation aborted at NMLRegAttack2.pl line 1.
build_dir_reuse is not set correctly
Solution
cpan
conf build_dir_reuse 0
o conf commit
exit

Mac OSX Perl cannot find DBD::mysql in #INC

I have installed CPAN module DBD::mysql via sudo cpan install DBD::mysql in order to run the code below, however I keep getting the error message:
Can't locate loadable object for module DBD::mysql in #INC (#INC contains:
/sw/lib/perl5/5.12.3/darwin-thread-multi-2level
/sw/lib/perl5/5.12.3
/sw/lib/perl5/darwin-thread-multi-2level
/sw/lib/perl5
/sw/lib/perl5/darwin
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level
/Network/Library/Perl/5.12
/Library/Perl/Updates/5.12.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.12.3
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12
.
)
at dbi_write.pl line 11
Compilation failed in require at dbi_write.pl line 11.
BEGIN failed--compilation aborted at dbi_write.pl line 11.
This is my code
#!/usr/bin/perl
#use lib '/usr/bin/cpan';
use strict;
use FileHandle;
use File::Spec;
use DBI;
use DBD::mysql;
Did your CPAN install succeed? If it did, then the module has been installed in the wrong place for the version of Perl you are running.
Look at the CPAN log to see where DBD::mysql has been installed. The answer lies there, and the fix depends on where it has been installed and why it isn't in your Perl's #INC.
Do you have multiple installations of Perl?
By the way, you don't have to use DBD::mysql. DBI will load it automatically when you call DBI->new specifying a MySQL source. That tidies up the code at the expense of loading the driver module at run time - a small price to pay.
I solved it by doing the following:
copy libmysqlclient.18.dylib into /usr/lib/
Also, there are two different Perls in my Mac OS X. One in /usr/local/ActivePerl5.16/ And another in /Systems/Library/Per/Perl5.12

How to include other folders within the #INC for Perl? (Was: `Can't locate Git.pm in #INC` for svn2git)

I am attempting to import an svn repo into git via svn2git. When I run svn2git --verbose https://url_to_repo I end up getting the following output:
Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches https://url_for_repository
Can't locate Git.pm in #INC (#INC contains: /usr/lib/perl5/site_perl/5.8.8 /home/cpdirect/perl5/lib/perl5 /usr/local/lib/perl5/5.8.8/x86_64-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .) at /usr/libexec/git-core/git-svn line 80.
BEGIN failed--compilation aborted at /usr/libexec/git-core/git-svn line 80.
command failed:
2>&1 git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches https://url_for_repository
It is obvious that Perl is unable to find the module within the path, however everything I've tried so far on CentOS 5.9 has not yielded results. For example, the following are installed:
git-1.7.11.3-1.el5.rf
git-svn-1.7.11.3-1.el5.rf
cpanel-git-1.7.11.3-1.cp1136
Any ideas of how to resolve this issue?
So it turns out that for some reason Perl doesn't know how to look at /usr/lib/perl5/vendor_perl/5.8.8/. If I make links to every module that it needs within /usr/lib/perl5/site_perl/5.8.8 it works seemingly fine and without error.
So the real question here is HOW do you force Perl to look under that vendor_perl folder?
So I've discovered how to add multiple libs and it solves the missing Perl libs:
PERL5LIB="/usr/lib/perl5/vendor_perl/5.8.8/:/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi" svn2git -v file:///my/path/to/svn/repo

Resources