Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Script Syntax Checker

Status
Not open for further replies.

RPrinceton

Programmer
Jan 8, 2003
86
US
Hi everyone,
Does anyone know of a product that can check a Perl script for syntax and blatant coding errors to help thwart the dreaded Internal Server Error? I really do not want to install a full blown version of Perl on my machine.
Please advise. Thx in advance.
Regards,
Randall Princeton
 
There might be a better solution, but what I do is have an error file opened immidiately, using the following code (placed anywhere, really):

Code:
BEGIN {
  my $curTime = localtime;
  open(STDERR, "> scriptErrorLog.txt");
  print STDERR "The script was last called on $curTime\n\n";
}

It'll still give you an internal server error when things go wrong, but it should at least tell you whats wrong in the scriptErroLog.txt file when you check it.

HTH,

Nick
 
If you have the CGI Module installed and running, try using CGI::Carp to send all errors to the browser. That way at least something gets to the users, even if it isn't a nice pretty error message.

Code:
use CGI::Carp qw/fatalsToBrowser/;

- Rieekan
 
assuming you have access to the remote server that the script is going to run on

log on with SSH (telnet on a LAN, if you trust everyone), and
Code:
perl -c myscript.pl

A full blown perl installation isn't that big anyway, what's your opposition?

HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ... smack the fecker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top