Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

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

Now, philosophical question: if this really should be desired behavior and left alone, then i am all for that.

Carp may not really be what you need here. If your error messages are intended to be seen by programmers (i.e., you when you're debugging) then you should leave the entire trace so you (or a maintainer) don't go crazy looking for an error in foo.pl when it really originates in Foo.pm. Besides, it'll be a pain trying to figure out the correct $CarpLevel value if you have metethods within Foo.pm call other methods who call other methods...that eventually generate the error.

If your error messages are intended toward the foo.pl user, who may not be a Perl programmer, then Carp's output will really going to confuse them no matter what the trace is. The user really only needs to know the error message, not what line the error occurred on. I'd suggest a cleaner output of error messages for them, holding their hand, and telling them that everything's going to be OK--not spitting out line numbers and script names.

BTW, if you're doing this with a CGI script, check out Ovid's warnings on using CGI::Carp at http://www.easystreet.com/~ovid/cgi_course/lesson_three/lesson_three.html.


In reply to Re: Confusion about properly using Carp by koolade
in thread Confusion about properly using Carp by jeffa

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 examining the Monastery: (5)
As of 2024-04-19 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found