Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Mucky Monks,

It's the darndest thing - my script uses the DBI to retrieve some data from a MYSQL database then output it into a Template::Toolkit template. Among other things, these lines are included at the top of the script to give me useful debugging info:

use warnings; # load modules use CGI; use CGI::Carp qw(fatalsToBrowser); use DBI; use Template; use HTML::Entities; # error output BEGIN { use CGI::Carp qw(carpout); carpout(STDOUT); }
And everything runs hunky-dory. Script runs to completion just fine, no error messages output to the browser. So I'm done developing, time to turn off the error messages, so I comment out:
# BEGIN { # use CGI::Carp qw(carpout); # carpout(STDOUT); # }
And it hangs. Just sits there 'til the browser times out. Comment back in, runs just fine again.

What the hey?




Forget that fear of gravity,
Get a little savagery in your life.



UPDATE: Problem Solved

Many thanks to philcrow and ikegami - using their various suggestions, the script now runs just fine with carpout commented out. Here's how I applied their info:

Via telnet, used the "Script" unix command to start script logging into a text file

script debug.txt;
Then ran the perl script successfully by passing all the parameters needed
REMOTE_USER=username perl myscript.pl param_1=x param_2=y param_3=z;
Stop the script logger
exit;
This has the excellent result of outptting everything - error messages and html output - to the debug.txt file for review.

I found a few things, including a sub-routine that was present in two separate places (this script "includes" several others), and a whole whack of lines using undeclared variables in if-statements. Cleaning it all up magically made it run.


In reply to Commenting out carpout causes script to hang by punch_card_don

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found