Skip to content

Instantly share code, notes, and snippets.

@xenoterracide
Created May 11, 2012 03:21
Show Gist options
  • Select an option

  • Save xenoterracide/2657327 to your computer and use it in GitHub Desktop.

Select an option

Save xenoterracide/2657327 to your computer and use it in GitHub Desktop.
Exception::Base
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