Calling the perl module from the current directory

I need to test perl script on a remote server. I tried to run it, but I got an error

Can't locate Date/Manip.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 . 

So, I downloaded the DateManip.pm file and tried to copy it to one of the specified locations. But I do not have permission to copy the file in any of these places. Is there a way that I can have this * .pm file in my own directory and call it from there or should I put it in one of these places?

+3
source share
2 answers

- DateManip.pm, , , - , , , perl script, :

 use FindBin qw($Bin);
 use lib "$Bin/<relative_path_to_module>";

<relative_path_to_module> - , DateManip.pm. , -../lib,

use FindBin qw($Bin);
use lib "$Bin/../lib";
+7

Perl ( ) . :

./your_program.pl     <= "use DateManip"
./DateManip.pm

Date:: Manip, :

./your_program.pl     <= "use Date::Manip"
./Date/
./Date/Manip.pm
+3

Source: https://habr.com/ru/post/1761703/


All Articles