Let's say you have a module named foo.pm. In this example, on a Linux system, the module is located at /usr/shared/perl/modules/foo.pm.
Let's say you have a Perl script named bar.pl that wants to use the foo.pm and Net::SSH::Perl modules.
#!/usr/bin/perl use strict; use warnings; use foo; use Net::SSH::Perl;
Let's say you invoke bar. pl . .
. . . and the following is returned. Notice in this example that /usr/share/perl/modules is not included.
Can't locate foo.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at bar.pl line 4.
One option here is to include use lib followed by the directory that contains the module in your Perl script.
#!/usr/bin/perl use strict; use warnings; use lib "/usr/share/perl/modules"; use foo;