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