Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: unified warnings, good or bad?

by Jenda (Abbot)
on Nov 26, 2009 at 13:24 UTC ( [id://809560]=note: print w/replies, xml ) Need Help??


in reply to unified warnings, good or bad?

There's one important difference between warn vs. carp and die vs. croak. The later is "from perspective of caller". Loosing the distinction would be fairly bad.

If your subroutine complains about an invalid/missing parameter, it's pointless to tell the developer the position of the test, you want him to know the position of the call so you carp/croak. OTOH, if something goes crazy within the inner workings of the subroutine, it should warn/die.

You can turn croak() to confess() and carp() to cluck() by "use Carp qw(verbose);" or by "perl -MCarp=verbose script.pl" and it would be nice to be able to control warn() and die() like this as well, but definitely not by turning them to confess() and cluck(). You'd loose the first (several) frame(s)!

Jenda
Enoch was right!
Enjoy the last years of Rome.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://809560]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-23 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found