Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Idomatic Handling of Subroutine Error

by btrott (Parson)
on Sep 18, 2001 at 22:58 UTC ( [id://113177]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        use vars qw( $ERROR );
    
    ...
           return;
        }
        sub errstr { ref($_[0]) ? $_[0]->{_errstr} : $ERROR }
    
  2. or download this
        return $obj->error("Got an error") unless $foo;    ## OR
        return $class->error("Got an error") unless $foo;
    
  3. or download this
        $obj->foo or die $obj->errstr;    ## OR
        My::Class->foo or die My::Class->errstr;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found