tdrought has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I recently had to move my Perl scripts to another server at my web hoster because a module stopped working and I could no longer use LWP commands. On this new server though, I don't receive error messages when the script has a problem. On the old server, it used to say things like "Create global variable" and stuff like that to help me debug my code. Now, I just always get a generic CGI Error page in my browser and I have to manually hunt down the problem. How do I turn the debugging on? Is it a module that my hoster is missing? Unfortuanely, I dont have access to a shell, and -w does nothing for me. Thanks, Tom

Replies are listed 'Best First'.
Re: Debugging with ActivePerl
by marto (Cardinal) on Feb 16, 2006 at 15:37 UTC
    Hi tdrought,

    Have a read at tachyon's CGI Help Guide tutorial, it has a section titled Debugging which you should read.
    Adding use CGI::Carp qw(fatalsToBrowser); at the top of your code should return errors to the browser.
    Assuming you have access to your log files, check for errors there.
    You may also want to Super Search this problem.

    Hope this helps.

    Martin
Re: Debugging with ActivePerl
by rinceWind (Monsignor) on Feb 16, 2006 at 15:40 UTC

    I presume you don't have access to the server logs, which is a shame. One hosting company I know sends daily extracts from the apache error log by email to their clients.

    Anyway, presuming you don't have access to the server logs, put the following line into the CGI script you are debugging:

    use CGI::Carp qw(fatalsToBrowser);

    And remember to take it out when you have finished debugging, if you care about security that is. For more on this aspect, see Does fatalsToBrowser give too much information to a cracker?.

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)