Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by legato (Monk)
on Jan 19, 2005 at 15:09 UTC ( #423402=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    unless ( $object->method('param') ) {
        ## somehow get $errstr
    ...
    }
    
    ## %erract contains such things as ('220' => sub { die $_ });
    
  2. or download this
    unless ( $object->method('param') ) {
        my ($errcode) = split ' ', $_;
        &$erract{$errcode}($_);
    }
    
  3. or download this
    eval { $object->method('param') }; if ($@) {
        my ($errcode) = split ' ', $@;
        &$erract{$errcode}($@);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://423402]
Approved by Corion
Front-paged by holli
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-12-26 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (171 votes), past polls