B
B
bestuk132016-02-25 20:31:19
Perl
bestuk13, 2016-02-25 20:31:19

How to install a module and write the path to @INC?

Good day of the day! you need to run a perl script - mailer.pl
installed Strawberry Perl. installed the necessary modules from CPAN.
I run the script.
Error:
6bb7b510495f4f41a919928c4527c2e8.png
Code

1 #!/usr/bin/perl
2
3 #use forks;
4 use threads;
5 use threads::shared;
6 use strict;
7 use warnings;
8 use Data::Dumper;
9 use lib::file;

Please tell me how to install the file.pm self-written module and write the paths in @INC
I'm not a programmer. I can't write in Perl. Day 2 trying to figure it out.
for these 2 days. I learned a lot about Perl, but I can't install
Paths
c:\mailer\mailer.pl - script
c:\mailer\lib\file.pm - module to be installed
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
targumon, 2016-02-25
@bestuk13

It is not entirely clear what specific module is being referred to, either about lib::file, or about the file module, which lies in the lib directory. I will go with the second option.
There are several ways to include the required library:

BEGIN { unshift @INC, 'c:\mailer\lib'; }
# или
use lib qw( c:\mailer\lib );
# или
use lib::abs qw( c:\mailer\lib );
# или
use lib::abs qw( lib );

# ...еще какая-то магия

If it is assumed that the lib library will be located in the same directory as the mailer.pl script, then it is enough to install the lib::abs module and write:
#!/usr/bin/perl

#use forks;
use threads;
use threads::shared;
use strict;
use warnings;
use Data::Dumper;
use lib::abs qw( lib );
use file;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question