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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-12-13 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (381 votes). Check out past polls.

    Notices?