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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl debugger question

Status
Not open for further replies.

Kathy1

Programmer
Dec 21, 2000
39
0
0
US
Hi.

We are looking for a good Perl debugger, and our tech services guru has checked out a couple of them. He has indicated that the debuggers he's looked at (this includes Active Perl, Komodo) do not work if the Perl script is activated from a webpage. The script must be activated from an icon on the desktop or a DOS command.

This seems quite odd to me, as I'm betting most scripts are activated by webpages via the 'submit' command on a standard HTML form - at least in our system 96% of them are web-page activated.

Has anyone else run across this situation, and is there a debugger out there that works with web-page activated Perl scripts?

We are running on an NT server and Windows 98 platforms.

Thanks for your help.

Kathy *:->*
 
I don't know of a debugger that can reach over onto another server
and check all the dependencies a particular piece of code may have.
But, I have had good luck with a fairly simple strategy.

First, make sure the code is syntactically correct with
#prompt> perl -c yourCode.cgi <return>

Second, if moving the file from a Win box to a *NIX box
make sure to convert your file to UNIX flavored line
endings.
#prompt> dos2unix yourCode.cgi tempFileName <return>
#prompt> mv tempFileName yourCode.cgi <return>


Third, make sure the code is executable by the web daemon
On a *nix box,
#prompt> chmod +x yourCode.cgi <return>

Or, via an ftp client, tell the ftp client to make the code
executable when it is transfered.

Fourth, use a simple sub routine where you would normally use 'die'.
Any time you do anything in the code that requires some
permissions to a file or database connection, etc...., call the
sub on failure.

open(AFILE,&quot;<someInputFile&quot;) or ooops(&quot;Failed to open someInputFile, $!&quot;);

sub ooops
{
my $error = shift;
print &quot;<p>CGI ERROR - $error</p></body></html>\n&quot;;
# you now have your error reported to the browser, now die.
die;
}

HTH




keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top