Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Idomatic Handling of Subroutine Error

by btrott (Parson)
on Sep 18, 2001 at 22:58 UTC ( #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
Node Status?
node history
Node Type: note [id://113177]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2020-07-09 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?