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
|
|