Errors with perl require statement

Alles, was Perl betrifft, kann hier besprochen werden.

Errors with perl require statement

Postby moneysav » 19. November 2011 05:37

I have decided on using htdocs/test/xyz.pl method. I put all my .pl files into the test folder.

when I put 'http://localhost/test/xyz.pl into the web browser with control panel running and green on apache and mysql, my xyz.pl file had been found and past the shebangs at line 13 I get the following error:

===================================================================
The server encountered an internal error and was unable to complete your request.

Can't locate config.pl in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib . C:/xampp/apache) at C:/xampp/htdocs/test/auction.pl line 13. ,
====================================================================

Even though the config.pl file is there in the test folder.


In xyz.pl line 13 is:
require "config.pl";

Alex

p.s. can I leave xampp control panel open and running while on the web? ohh, do you want to see the shebangs?
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
XAMPP Version: 5.6.3
Operating System: windows xp

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 05:50

Alex, why put the shebang on line 13, why not where it should go on line 1 ?
All your .pl files and .cgi files should have the shebang on line 1 only, no where else.

Your shebang should be:[code]#!"C:\xampp\perl\bin\perl.exe"

BTW internal error (500) can be seen in the C:\xampp\apache\logs\error.log file.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 05:55

When I moved the line in the demo printenv.pl I had this in the error.log file
Code: Select all
[Sat Nov 19 14:54:04 2011] [error] [client 127.0.0.1] G:/xampp177/cgi-bin/printenv.pl is not executable; ensure interpreted scripts have "#!" or "'!" first line
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 05:59

You can leave the Control Panel running and if you click on the top X it will drop to the system tray near the clock area.

If you are using the new XCPv3 panel then you have easy access to the log files using the Logs button.

In the forum sticky is the latest version with even more features.

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby moneysav » 19. November 2011 06:02

Ohh..

I mean shebangs are on line 1 of xyz.pl but not on all the rest of the .pl files because thats the way the program came for use on a live web server. If I am to use these files offline with Xampp then should I put the same shebang at line 1 of all the .pl programs ???

Alex
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
XAMPP Version: 5.6.3
Operating System: windows xp

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 06:04

They will not work unless they are on line 1 as the error log points out.

Check the log file if those other scripts give 500 errors with the shebang at line 13 before moving them just in case they work but I doubt it. :)

Use the error.log file as your guiding light. ;)

Apache looks on the first line, the shebang and if it finds one it sends it off to the interpreter for execution.

If no shebang then it tries to parse the code and will then error because it knows not what it is.

Did you have xyz.pl work now without error?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby moneysav » 19. November 2011 06:12

I am going off line and putting the shebang on all the files and will let you know
Alex
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
XAMPP Version: 5.6.3
Operating System: windows xp

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 06:15

Make backup copies if you need to. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 06:29

I just added a shebang to the first line of a pl file and at the start of the perl script (line 13 in your case) and the file loaded in the browser without error, so you might like to give that a try first.
Shebang on line one and on line 13 as the line 13 shebang seemed to be ignored.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby moneysav » 19. November 2011 06:36

Hi, I made sure that the above shebang is on line 1 of xyz.pl and config.pl

The line interpreter got past the shebang ok, I think my problem is the require statement

got this error:
Can't locate http://127.0.0.1/c:/xampp/htdocs/test/config.pl in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib . C:/xampp/apache) at C:/xampp/htdocs/test/xyz.pl line 12. ,

xyz.pl line 12 is:
require "http://127.0.0.1/c:/xampp/htdocs/test/config.pl";

Alex
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
XAMPP Version: 5.6.3
Operating System: windows xp

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 06:43

The require path should not have "http://127.0.0.1/ but simply
Code: Select all
require "C:/xampp/htdocs/test/config.pl"
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Where to put my .pl files?

Postby moneysav » 19. November 2011 10:58

yes, that is how I do have the path to config.pl

I thought it would be a good idea to take a very complex premade auction program that I use on the web and convert it to a way to be able to make simple changes to the look of my main page offline and do all my tests offline, but I AM STRUGGLING.

I keep getting this error:
Attempt to reload c:/xampp/htdocs/test/config.pl aborted. Compilation failed in require at C:/xampp/htdocs/test/auction.pl line 12. ,

This error does not tell me it config.pl has been located but there was something wrong inside of config.pl that I should fix, or that the opening path to config.pl is not correct.

Alex
moneysav
 
Posts: 29
Joined: 09. November 2011 00:06
XAMPP Version: 5.6.3
Operating System: windows xp

Re: Where to put my .pl files?

Postby Sharley » 19. November 2011 11:17

This topic has been split from XAMPP for Windows topic here:
viewtopic.php?f=16&t=49008


Yes Alex I can see you are struggling because you don't have any perl programming skills.

Take a look at what is on line 12 of auction.pl as it looks like another require issue.

If you have a configuration GUI page for the script then make sure all the paths are set correctly because if that 127.0.0.1 URI is being added to the paths then it could be from the configuration script etc. (in the config.pl perhaps?)

Look at the Apache error.log file as it may have some more details.

These Googles may help.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
XAMPP Version: 5.6.3
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to Perl

Who is online

Users browsing this forum: No registered users and 1 guest

cron