Created
May 11, 2012 03:21
-
-
Save xenoterracide/2657327 to your computer and use it in GitHub Desktop.
Exception::Base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use 5.014; | |
| use warnings; | |
| use Try::Tiny; | |
| use Exception::Base; | |
| try { | |
| if ( 0 ) { | |
| Exception::Base->throw( message => 'this sucks', value => 0 ); | |
| } | |
| if ( 1 ) { | |
| Exception::Base->throw( message => 'this really sucks', value => 1 ); | |
| } | |
| } | |
| catch { | |
| given ( $_ ) { | |
| when ( $_ == 0 ) { | |
| say $_; | |
| } | |
| when ( $_ == 1 ) { | |
| say $_; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment