Home: Perl Programming Help: Intermediate:
Error Can't locate /cgi-bin/static_data/dsn/dsn.pl in @INC



digioleg54
User

Apr 19, 2017, 1:51 PM


Views: 4946
Error Can't locate /cgi-bin/static_data/dsn/dsn.pl in @INC

I made a CGI script, put the line:

Code
use lib '/cgi-bin/static_data/dsn';

In the sub I have

Code
my $dsn_file = "/cgi-bin/static_data/dsn/dsn.pl"; 
require "$dsn_file";


But when I run the script, got an error


Code
Can't locate /cgi-bin/static_data/dsn/dsn.pl in @INC (@INC contains: /cgi-bin/static_data/dsn /export/applications/dte/perl-lib /vhosts/dw18637/lib/web/ /versions/perl-5.22.2/lib/perl5/site_perl/5.22.2/i686-linux /versions/perl-5.22.2/lib/perl5/site_perl/5.22.2 /versions/perl-5.22.2/lib/perl5/5.22.2/i686-linux /versions/perl-5.22.2/lib/perl5/5.22.2 /api .) at /vhosts/dw18637/lib/web/dtereport.pl line 122.


Could you please let me know how to escape such error?

Thanks a lot


FishMonger
Veteran / Moderator

Apr 19, 2017, 2:44 PM


Views: 4943
Re: [digioleg54] Error Can't locate /cgi-bin/static_data/dsn/dsn.pl in @INC

Don't specify the full path in $dsn_file specify the filename only.


Code
use lib '/cgi-bin/static_data/dsn'; 

my $dsn_file = 'dsn.pl';
require $dsn_file;



digioleg54
User

Apr 20, 2017, 7:28 AM


Views: 4935
Re: [FishMonger] Error Can't locate /cgi-bin/static_data/dsn/dsn.pl in @INC

I it/ The same problem. I just moved this file to my regular /lib/web directory, where I have all Perl packages and ours

Thanks