Installing Perl Libraries with and without CPAN
The following assumes a working knowledge of Linux/Unix shell.
Identifying Missing Perl Libraries
When using NMIS, it is likely you will encounter an error message like the following:
Can't locate Data/UUID.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.12.4 /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.12.4 /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/5.12.4 /opt/local/lib/perl5/site_perl/5.12.3 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl .) at scratch.pl line 3. BEGIN failed--compilation aborted at scratch.pl line 3.
The error message is telling you everything you need to know, the first part "Can't locate Data/UUID.pm in @INC" means that Perl can not find the module or libary called Data::UUID in the library folders named in the part "@INC contains:", and this problem was found at line 3 of scratch.pl "BEGIN failed--compilation aborted at scratch.pl line 3.".
Line 3 of this code contains the following:
use Data::UUID;
To make this work, Data::UUID will need to be installed, this can be done with or without using the.
Installing using CPAN
If the computer having the problem has an internet connection you can use the command cpan to install the library. The first time you run cpan it will ask a bunch of questions, the defaults will work 99% of the time, so accept them all.
cpan
Then you will be at a CPAN prompt, at this prompt just type "install <missing library name>", in this example:
install Data::UUID
Follow Prequest Automatically
You will be prompted and if doing this alot you might want to accept the prompts automatically, the following can be used and the CPAN shell prompt:
o conf prerequisites_policy follow o conf commit
Installing without CPAN
Find the Perl Library Source
If you don't have the Perl library source code, you will need to download it. Finding Perl Libraries is easy thanks to Google, so google Data::UUID and the first hit will most likely be the CPAN website:
Go to CPAN and download the package
Now you have the file to install the source code.
Install the Perl Library from Source Code
The next part is usually very straight forward 99% of the time, the commands to do this are very easy, assuming the tarball file is in your local directory:
tar xvf Data-UUID-1.218.tar.gz cd Data-UUID-1.218 perl Makefile.PL make make test # optional make install # if not root user then "sudo make install"
The output for that process will look something like this (this was done on MAC OSX, same for Linux, Solaris, etc):
loki:src keith$ tar xvf Data-UUID-1.218.tar.gz x Data-UUID-1.218/ x Data-UUID-1.218/Changes x Data-UUID-1.218/LICENSE x Data-UUID-1.218/Makefile.PL x Data-UUID-1.218/MANIFEST x Data-UUID-1.218/META.json x Data-UUID-1.218/META.yml x Data-UUID-1.218/ptable.h x Data-UUID-1.218/README x Data-UUID-1.218/smp-test/ x Data-UUID-1.218/t/ x Data-UUID-1.218/typemap x Data-UUID-1.218/UUID.h x Data-UUID-1.218/UUID.pm x Data-UUID-1.218/UUID.xs x Data-UUID-1.218/t/basic.t x Data-UUID-1.218/t/from-name-collisions.t x Data-UUID-1.218/t/leaky_dollar_bang.t x Data-UUID-1.218/t/pod-coverage.t x Data-UUID-1.218/t/pod.t x Data-UUID-1.218/t/segv.t x Data-UUID-1.218/t/threads.t x Data-UUID-1.218/smp-test/collision.t x Data-UUID-1.218/smp-test/uuid-fork.pl loki:src keith$ cd Data-UUID-1.218 loki:Data-UUID-1.218 keith$ perl Makefile.PL Checking if your kit is complete... Looks good Configured options (run perl Makefile.PL --help for how to change this): UUID state storage: /var/folders/3t/nz6h9cxd0ln0d11x6jvl9sr40000gn/T default umask: 0007 Writing Makefile for Data::UUID Writing MYMETA.yml and MYMETA.json loki:Data-UUID-1.218 keith$ make cp UUID.pm blib/lib/Data/UUID.pm /opt/local/bin/perl /opt/local/lib/perl5/5.12.4/ExtUtils/xsubpp -typemap /opt/local/lib/perl5/5.12.4/ExtUtils/typemap -typemap typemap UUID.xs > UUID.xsc && mv UUID.xsc UUID.c /usr/bin/clang -c -pipe -O2 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -fstack-protector -I/opt/local/include -O3 -DVERSION=\"1.218\" -DXS_VERSION=\"1.218\" "-I/opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/CORE" -D_STDIR=\"/var/folders/3t/nz6h9cxd0ln0d11x6jvl9sr40000gn/T\" -D__darwin__ -D_DEFAULT_UMASK=0007 UUID.c Running Mkbootstrap for Data::UUID () chmod 644 UUID.bs rm -f blib/arch/auto/Data/UUID/UUID.bundle env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/clang -L/opt/local/lib -bundle -undefined dynamic_lookup -fstack-protector UUID.o -o blib/arch/auto/Data/UUID/UUID.bundle \ \ chmod 755 blib/arch/auto/Data/UUID/UUID.bundle cp UUID.bs blib/arch/auto/Data/UUID/UUID.bs chmod 644 blib/arch/auto/Data/UUID/UUID.bs Manifying blib/man3/Data::UUID.3pm loki:Data-UUID-1.218 keith$ make test # optional PERL_DL_NONLAZY=1 /opt/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/basic.t ................. ok t/from-name-collisions.t .. ok t/leaky_dollar_bang.t ..... ok t/pod-coverage.t .......... skipped: Pod coverage tests are not active. Please set $ENV{AUTHOR_TESTING} to activate. t/pod.t ................... skipped: Pod coverage tests are not active. Please set $ENV{AUTHOR_TESTING} to activate. t/segv.t .................. ok t/threads.t ............... ok All tests successful. Files=7, Tests=36, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.25 cusr 0.05 csys = 0.34 CPU) Result: PASS loki:Data-UUID-1.218 keith$ sudo make install Password: Files found in blib/arch: installing files in blib/lib into architecture dependent library tree Installing /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level/auto/Data/UUID/UUID.bs Installing /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level/auto/Data/UUID/UUID.bundle Installing /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level/Data/UUID.pm Installing /opt/local/share/perl5.12/siteman/man3/Data::UUID.3pm Appending installation info to /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/perllocal.pod loki:Data-UUID-1.218 keith$ scratch.pl Hello World