sh-3.2# ./backup.pl 
Can't locate Net/RawIP.pm in @INC (@INC contains: /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at ./web-scanner.pl line 12.
BEGIN failed--compilation aborted at ./web-scanner.pl line 12.
sh-3.2# perl -MCPAN -e "install Net::RawIP" 
CPAN: Storable loaded ok (v2.19)
Going to read /var/root/.cpan/Metadata
  Database was generated on Mon, 13 Dec 2010 01:34:15 GMT
Net::RawIP is up to date (0.25).
  • What's the first line in backup.pl say? Are you certain it's calling the same perl that's in your PATH?
    – Ian C.
    Dec 13 '10 at 4:48

The module is not installed where Perl is looking. Before running the script, you can try using the PERL5LIB or PERLLIB to the path where the Module is installed. If you are running bash, you could put the following in your .bashrc:

export PERL5LIB=$PERL5LIB:/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level

Alternatively, you could add:

use lib '/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level';

in your Perl script but if you have a lot of Perl scripts, this might not be scalable.

Alternatively, you could install the module in one of the directories that is in @INC.

Or you could cheat and symbolically link the directory into one of the directories that is in @INC.

sh-3.2# find / -name 'RawIP.pm'
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
find: /private/var/folders/xN/xNX35epaFXiyQZnuMC3a3U+++TI/-Tmp-/.truecrypt_aux_mnt1: No such file or directory

Not the answer you're looking for? Browse other questions tagged or ask your own question.