Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by demerphq (Chancellor)
on Jan 19, 2005 at 17:58 UTC ( #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
Node Status?
node history
Node Type: note [id://423455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-12-22 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls