LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-03-2010, 09:01 AM   #1
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Rep: Reputation: 30
problem with @INC and use pragma in Perl


Quote:
1: #!/usr/bin/perl -w
2:
3: use CGI;
4: use CGI::Carp qw(fatalsToBrowser);
5: use CGI::Session;
6: use lib qw(/home/savio/myperlprograms);
7: use DataAccess; <------
8: use DBI;
9: use Template;
DataAccess.pm is placed into /home/savio/myperlprograms, but I have following errors:

Quote:
Can't locate DataAccess.pm in @INC (@INC contains: /home/savio/myperlprograms /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/lib/cgi-bin/login.cgi line 7.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/login.cgi line 7.
Where is the problem?
 
Old 10-03-2010, 09:17 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by shifter View Post
DataAccess.pm is placed into /home/savio/myperlprograms, but I have following errors:



Where is the problem?
Temporarily modify your program to do

Code:
my $cmd = '/bin/ls -ltr /home/savio/myperlprograms/DataAccess.pm';
warn "\$cmd=$cmd";
system($cmd);
- you'll need to comment out

Code:
use DataAccess;
and maybe other stuff which depends on it.

The point is to see STDOUT and STDERR of the modified program in order to make sure the file is really in the place where you expect it to be.
 
Old 10-03-2010, 09:47 AM   #3
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Original Poster
Rep: Reputation: 30
The output is:
Quote:
[Sun Oct 3 16:46:25 2010] login.cgi: $cmd=/bin/ls -ltr /home/savio/myperlprograms/DataAccess.pm at login.cgi line 15.
-rwxr-xr-x 1 savio savio 5957 2010-09-30 18:57 /home/savio/myperlprograms/DataAccess.pm
with following code:

Quote:
1: #!/usr/bin/perl -w
2:
3: use CGI;
4: use CGI::Carp qw(fatalsToBrowser);
5: use CGI::Session;
6: use lib qw(/home/savio/netstore);
7: use DataAccess;
8: use DBI;
9: use Template;
10:
11: my $cgi = CGI->new();
12: print $cgi->header(-type => 'text/html');
13:
14: my $cmd = '/bin/ls -ltr /home/savio/netstore/DataAccess.pm';
15: warn "\$cmd=$cmd";
16: system($cmd);

Last edited by shifter; 10-03-2010 at 09:49 AM.
 
Old 10-03-2010, 09:52 AM   #4
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Original Poster
Rep: Reputation: 30
Ok, thank you, it is a permissions problem of myperlprograms folder.

Thank you for helping
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use #pragma twwwater Programming 6 01-03-2010 04:58 AM
#pragma vedanu Programming 2 02-21-2007 04:15 AM
#pragma pack directive rajesh_b Programming 2 09-25-2006 04:05 AM
Linux equivalents for #pragma DavidW567 Programming 2 03-09-2005 01:24 PM
Pragma: no-cache workaround OhLordy Linux - Networking 1 05-09-2003 05:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration