Jump to content

Debugging Perl


Recommended Posts

Pardon the slight rant surrounding this question: ;)


Is there any way to get more useful error messages out of my perl scripts. It seems that if there's anything wrong at all, I get "Premature end of headers" in the log file.


I've got the permissions set right (755)...


There are various problems I've found with scripts by fumbling around, but I got no help from error messages.


I didn't realize how much I'd miss the shell access I had with my previous host. When I had a shell, I could run the script on the command line to see what came out. Without that, I have only the error messages to go by. One useful thing would be, a way (presumably within cpanel) that I could run a script and redirect the output to a file I can download and read.


Thanks for your help,


Link to comment
Share on other sites

I've found that many of the jobs I used to do with shell, can be done with cron jobs. I've used those a whole lot more than I ever anticipated!


If you're doing heavy duty testing of scripts you write yourself, maybe you should set up your own Linux box at home. If you've got an old computer somewhere (even an old P1 100 MHz box will do, and even older if it's got a decent size hard drive), you can set it up and use for testing.

Link to comment
Share on other sites

When you create a new Perl script in Cpanel, the "blank" script contains these lines:


use CGI::Carp qw(fatalsToBrowser);


That second line will dramatically improve your life. It's like having shell access, except the output is nicely formatted HTML. From the day of discovery, I haven't left that line out of a single script I've created.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...