Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Handling non-fatal method error strings without exceptions or globals?

by demerphq (Chancellor)
on Jan 19, 2005 at 17:58 UTC ( [id://423455]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Scalar::Util qw(dualvar);
    my %Error=(220=>"Cannot connect to service");
    ...
    }
    my $x;
    $x=mysub() or die $Error{$x};
    
  2. or download this
    use Scalar::Util qw(dualvar);
    my %Error=(220=>"Cannot connect to service");
    ...
    }
    
    mysub() or die sprintf "%d %s",$@,$Error{0+$@};
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found