Troubleshooting

Some times a program will not run. Here we can look at some reasons why and how to figure out what to do to fix it.

It is always a good idea for you as the program to test your program by running it from the command line of a terminal. This way you will see any reports of errors that should be corrected.

In this error we see there is a missing library. Perl searches for the library in all of the known paths but did not find it. Perl keeps all of the paths to include in a special array @INC.

#!/usr/bin/perl
 
use MissingLibrary;
 
print "did you see that?\n";
Can't locate MissingLibrary.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 
/usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 
/usr/local/lib/site_perl .) at ./test.pl line 3.
BEGIN failed--compilation aborted at ./test.pl line 3.

The solution is to find the package and install it. If you have the package installed maybe it is not in a library path that Perl knows about. You can add the path to help Perl find the library.

push(@INC,  "/the/directory/where/I/keep/my/library/files/");
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License