Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 20th, 2009, 05:42 PM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
Help with an error message

If this is the wrong place to post this I am sorry but I have not been able to find a good forum on cgi. If this is not the right forum please direct me to the right place.
Well here goes:

I am setting up a Traffic Exchange script. It is a good script I have had it up and running before. With no errors. I have decided to reinstall the script but when I try to run the script
to setup the db I keep getting an error. I can program but I did not write this one.
The path is correct I checked with the ISP

My path to purl: #!/usr/local/bin/perl

My call is: require "home/snickers123/profitx2.com/420/iConfig.pm";

The error message: Can't locate
home/snickers123/profitx2.com/420/iConfig.pm (This is the part I do not understand) in @INC (@INC contains:
/etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
/usr/local/lib/site_perl .) at inst_mysql.cgi line 41.

Thank you for any help you can give me.
Snickers123 (Len)

Reply With Quote
  #2  
Old October 20th, 2009, 06:53 PM
FishMonger FishMonger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 262 FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 2 h 31 m 51 sec
Reputation Power: 403
Your require statement is using a relative path. You should change it to an absolute path.
Code:
require "/home/snickers123/profitx2.com/420/iConfig.pm";


Here's another option which is generally considered better.

Code:
use lib '/home/snickers123/profitx2.com/420';
use iConfig;

Reply With Quote
  #3  
Old October 20th, 2009, 09:46 PM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
Tried it

Thank you very much for your help. Tried both the absolute path and the other it made no difference I get the same error

Reply With Quote
  #4  
Old October 20th, 2009, 09:59 PM
FishMonger FishMonger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 262 FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 2 h 31 m 51 sec
Reputation Power: 403
Next step is to verify that the path you're using is correct and make sure the permissions on each directory within that path are set correctly to allow the web server user account access.

Reply With Quote
  #5  
Old October 21st, 2009, 01:02 AM
Demmy Demmy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Sweden
Posts: 12 Demmy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 12 m 18 sec
Reputation Power: 0
Send a message via Google Talk to Demmy
Quote:
Originally Posted by snickers123
Thank you very much for your help. Tried both the absolute path and the other it made no difference I get the same error


Hi! Looks like the path is fine, since I can load and see the file from here.

A caution about security:
Your modules should NOT be accessable from the outside!
If the webserver allows it, move the modules to /home/snickers123/lib/ and add that to the script as such:
perl Code:
Original - perl Code
  1. use lib '/home/snickers123/lib/';
  2. use iConfig.pm;


When you've moved it, change your MySQL password, as a bunch of people have probably already seen it, including the all-seeing eye (GoogleBot).

perl Code:
Original - perl Code
  1.  
  2. $mysql_dbname = "te_data";
  3. $mysql_username = "lparnau";
  4. $mysql_password = "ichangedthispartforyou";
  5. $mysql_host = "mysql.profitx2.com";

Reply With Quote
  #6  
Old October 21st, 2009, 01:52 AM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
The path is right

I checked the path with the ISP and it is correct.
The permissions are set as follows.
The cgi-bin folder and all it's sub-directories and all .cgi files are set to 755. The data dir. is named 420 and is set at 777 along with all its files.

This has really got me stumped. I really do thank you for all your help.

Snickers123 (Len)

Reply With Quote
  #7  
Old October 21st, 2009, 01:58 AM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
Please give me a hint

If the path works for you please can you give me any hint why it is not working for me?

Thank you for your tips. I already deleted the data base and will set the data file up in the root.


Snickers123 (Len)

Reply With Quote
  #8  
Old October 21st, 2009, 03:01 AM
Demmy Demmy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Sweden
Posts: 12 Demmy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 12 m 18 sec
Reputation Power: 0
Send a message via Google Talk to Demmy
The problem now is that Perl can't "see" the files.

Did you try with...
perl Code:
Original - perl Code
  1. use lib '/path/to/the/files/';
  2. use ThePMFile; # Without the .pm extention
  3.  

...?

If you did, can you post the error message as it shows with that in place?

Reply With Quote
  #9  
Old October 21st, 2009, 03:55 AM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
Error Message

Code:
#!/usr/local/bin/perl     Line 1

use CGI::Carp qw(fatalsToBrowser);   Line39
require "use lib '/home/snickers123/420'";   Lline 40
use iConfig;       Line 41
require "use lib '/home/snickers123/420'";    Line 42
use iSubs;         Line 43


Error: Can't locate iConfig.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at inst_mysql.cgi line 41.
BEGIN failed--compilation aborted at inst_mysql.cgi line 41.

Snickers123

Reply With Quote
  #10  
Old October 21st, 2009, 04:27 AM
Demmy Demmy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Sweden
Posts: 12 Demmy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 12 m 18 sec
Reputation Power: 0
Send a message via Google Talk to Demmy
Quote:
Originally Posted by snickers123
Code:
#!/usr/local/bin/perl     Line 1

use CGI::Carp qw(fatalsToBrowser);   Line39
require "use lib '/home/snickers123/420'";   Lline 40
use iConfig;       Line 41
require "use lib '/home/snickers123/420'";    Line 42
use iSubs;         Line 43


Error: Can't locate iConfig.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at inst_mysql.cgi line 41.
BEGIN failed--compilation aborted at inst_mysql.cgi line 41.

Snickers123


Aha, I've spotted the misunderstanding.

not
Code:
require "use lib '/home/snickers123/420'";

but just
Code:
 use lib '/home/snickers123/420';


Compare use to require in perldoc.
I strongly encourage you to use "use".

Last edited by Demmy : October 21st, 2009 at 04:31 AM. Reason: I really should use the spellchecker >.<

Reply With Quote
  #11  
Old October 21st, 2009, 05:52 AM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
Quote:
Originally Posted by Demmy
Aha, I've spotted the misunderstanding.

not
Code:
require "use lib '/home/snickers123/420'";

but just
Code:
 use lib '/home/snickers123/420';


Compare use to require in perldoc.
I strongly encourage you to use "use".


Is this the right syntax for a required file: use lib '/home/snickers123/420';
use html_head.inc;

This script was written back in 2002. Is it to old to run on todays servers. Old script, out of date syntex.

Snickers123

Reply With Quote
  #12  
Old October 21st, 2009, 08:28 AM
FishMonger FishMonger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 262 FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)FishMonger User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 2 h 31 m 51 sec
Reputation Power: 403
Quote:
Originally Posted by snickers123
Is this the right syntax for a required file: use lib '/home/snickers123/420';
use html_head.inc;

This script was written back in 2002. Is it to old to run on todays servers. Old script, out of date syntex.

Snickers123

That's close.

Try this:
Code:
use lib '/home/snickers123/420';
use 'html_head.inc';


or this (since html_head.inc is not a true module/package):
Code:
use lib '/home/snickers123/420';
require 'html_head.inc';

Reply With Quote
  #13  
Old October 21st, 2009, 08:43 AM
Demmy Demmy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Sweden
Posts: 12 Demmy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 12 m 18 sec
Reputation Power: 0
Send a message via Google Talk to Demmy
Quote:
Originally Posted by snickers123
Is this the right syntax for a required file: use lib '/home/snickers123/420';
use html_head.inc;

This script was written back in 2002. Is it to old to run on todays servers. Old script, out of date syntex.

Snickers123


From what I saw when I was snooping around in there, html_head.inc isn't Perl code, but HTML.

Am I wrong?

Reply With Quote
  #14  
Old October 21st, 2009, 07:02 PM
snickers123 snickers123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 7 snickers123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 55 sec
Reputation Power: 0
The script is running great now.

Thank You Very,Very Much

It seems to be working fine now.


The last require did the trick. I really can not thank you enough for taking the time. The problem was just in the calls. Now I have my work cut out for me. I need to go through the entire script and find all the calls.


Have a really great day
Snickers123

Reply With Quote
  #15  
Old October 22nd, 2009, 12:08 AM
Demmy Demmy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Sweden
Posts: 12 Demmy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 12 m 18 sec
Reputation Power: 0
Send a message via Google Talk to Demmy
Quote:
Originally Posted by snickers123
Thank You Very,Very Much

It seems to be working fine now.


The last require did the trick. I really can not thank you enough for taking the time. The problem was just in the calls. Now I have my work cut out for me. I need to go through the entire script and find all the calls.


Have a really great day
Snickers123


Excellent, congrats!

I've often found that completely rewriting stuff with the legacy code as a guide is faster and less frustrating, but if you're only just starting out with Perl that's probably not the case for you.

You could grep through the file for "sub", I guess?

Anyway, best of luck to you!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Help with an error message


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek