Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: eval to replace die?

by BrowserUk (Patriarch)
on Oct 04, 2010 at 13:35 UTC ( [id://863341]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict;
    ...
    my $result = eval{ divide( @ARGV ) } or die $@;
    
    print "Result: $result";
    
  2. or download this
    __END__
    C:\test>NoExceptions
    ...
    
    C:\test>NoExceptions 1 2
    Result: 0.5
    
  3. or download this
    #MyExceptions.pm
    package MyExceptions;
    ...
        $e = Exception::Class->caught();
        ref $e ? $e->rethrow : die $e;
    }
    
  4. or download this
    #! perl -slw
    use strict;
    ...
    };
    
    print "Result: $result";
    
  5. or download this
    __END__
    C:\test>Exceptions-TryTiny
    ...
    C:\test>Exceptions-TryTiny 1 2
    Result: 0.5
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found