Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Nice style for interesting error messages

by Fastolfe (Vicar)
on Jan 24, 2001 at 21:46 UTC ( [id://54057]=note: print w/replies, xml ) Need Help??


in reply to Nice style for interesting error messages

Since "success" and "failure" seem to be pretty arbitrary, I might consider reversing the role of your function here:
my $failure = is_taken($domain); print "Failed: $failure\n" if $failure;
In the more general case, some modules tend to use $@ to store error messages, or a package-specific variable (say, $Lookup::errstr) containing the message:
unless (lookup($domain)) { print $@ ? "$domain lookup failure: $@\n" : "$domain is available!\n"; }

Replies are listed 'Best First'.
Re: Re: Nice style for interesting error messages
by merlyn (Sage) on Jan 25, 2001 at 04:12 UTC
    Please don't store anything into $@. Don't repeat Graham Barr's acknowledged mistake. $@ is documented as "errors from eval" only. User code shouldn't be pushed around in there.

    -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found