Perl Code wont work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Perl Code wont work

Postby hap_zax » 28. December 2006 04:12

hi guys,

whenever i try to upload my perl code on the windows localhost it displays and Error 500 page?

Could anyone help me on this?

Any help would be appreciated.
Thanx :)
hap_zax
 
Posts: 14
Joined: 19. December 2006 16:32

Re: Perl Code wont work

Postby Izzy » 28. December 2006 07:00

hap_zax wrote:hi guys,

whenever i try to upload my perl code on the windows localhost it displays and Error 500 page?

Could anyone help me on this?

Any help would be appreciated.
Thanx :)

When ever you get a server error look in the Apache error log, it usually contains the clues you are looking for:
xampp\apache\logs\error.log
Open it in your text editor by association or by drag and drop for viewing.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby hap_zax » 28. December 2006 07:53

well it says that no file found... but that file is in the folder specified... i.e. in the htdocs folder..
also it says that no CGI.pm found???

Do you have any other opinion there?
hap_zax
 
Posts: 14
Joined: 19. December 2006 16:32

Postby Izzy » 28. December 2006 08:07

hap_zax wrote:well it says that no file found... but that file is in the folder specified... i.e. in the httpd folder..

Do you have any other opinion there?

If Apache can't find the file then that is a fact.

Check and double check your paths also make sure the shebang line at the very top of your script has the correct path to your perl installation.
Example shebang line:
#!C:/xampp/perl/bin/perl
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby hap_zax » 28. December 2006 08:13

Now it gives me this error:

[Thu Dec 28 07:11:54 2006] [error] [client 127.0.0.1] Premature end of script headers: catalogue.cgi

[Thu Dec 28 07:11:54 2006] [error] [client 127.0.0.1] Can't locate CGI.pm in @INC (@INC contains: .) at C:/Program Files/xampp/htdocs/catalogue.cgi line 3.\r

[Thu Dec 28 07:11:54 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at C:/Program Files/xampp/htdocs/catalogue.cgi line 3.\r
hap_zax
 
Posts: 14
Joined: 19. December 2006 16:32

Postby Izzy » 28. December 2006 09:06

It seems that your original problem has been solved as perl is now parsing your script.
It can't proceed till it can locate the CGI.pm file that is required.
Hence the premature end of script headers error.

In the default XAMPP installation there is a light version of perl which may not have the CGI.pm perl module.
I can't test that as I have the full perl add-on installed in my XAMPP.
The full perl does have CGI.pm and it is located in C:\xampp\perl\lib on my system.

Do a search in your Xampp tree for the missing file.
If you don't come up with it then to get your scripts working using CGI.pm you may have to download and install the full perl add-on found on the Xampp for Windows page here:
http://www.apachefriends.org/en/xampp-windows.html#644

Follow the easy install instructions in the readme file and your script should then work.

I had a similar issue with the light version. It is not designed for full complex perl scripts as most require, like your script, perl modules (*.pm) that the light version just doesn't have.
To fix it I had to install the full perl version.

More info about your error here:
http://www.google.com/search?q=Can%27t+locate+CGI.pm
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby hap_zax » 28. December 2006 17:43

ok everything seems to be working fine ... but whenever i upload a code i get this error:

Can't find string terminator "EndHdr" anywhere before EOF at C:/Program Files/xampp/htdocs/catalogue.cgi line 17

Can you be able to help?

Thanx
hap_zax
 
Posts: 14
Joined: 19. December 2006 16:32

Postby Izzy » 29. December 2006 00:37

hap_zax wrote:ok everything seems to be working fine ... but whenever i upload a code i get this error:

Can't find string terminator "EndHdr" anywhere before EOF at C:/Program Files/xampp/htdocs/catalogue.cgi line 17

Can you be able to help?

Thanx

This is a syntax error in the code. It is telling you that a string terminator "EndHdr" is missing usually after some html.

Example:
print <<EndHdr;
<html><head><title>My Data</title></head>
<body>
<center>
<h2 align="CENTER">My Data</h2>
<table border="1">
<tr>
EndHdr
;




Either re download the script, fix the syntax error or contact the place you aquired the script from and expalin your issue to them.

Some reading for you:
http://www.google.com/search?q=Can%27t+ ... terminator
http://www.google.com/search?q=endhdr

ActiveStates explanation of this error:
Why do I get an error using Perl's here-doc syntax (<<), that says "Can't find string terminator anywhere before EOF"?

This is a weird error that occurs when your string terminator is on the last line of your script. With a script like:

print <<"END";
The snake is old, and his skin is cold.
END

perl is looking for the word END on a line by itself, followed by a line-feed character (\n). If the END is the last line of your script, you have to remember to hit <Enter> after the word END, so that Perl can recognize it as the string terminator.

Most UNIX text editors will do this automatically. Most Windows text editors won't. Thus the problem.

Note that this can also cause a problem with Perl formats, since these are terminated with a single . on a line by itself. However, it's much more rare, since programmers often specify the format for output at the top rather than at the bottom of a file.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 67 guests