Help for this page

Select Code to Download


  1. or download this
    use Storable;
    use MIME::Base64;
    ...
     die encode_base64(freeze({errorcode => 12, errormess => 'you have die
    +d'}));
    };
    print "error caught: ".Dumper(thaw(decode_base64($@))) if $@;
    
  2. or download this
    use Data::Dumper;
    
    ...
     die bless {errorcode => 12, errormess => 'you have died'} => 'My::Exc
    +eption';
    };
    print "error caught2: ".$@->{errormess}."\n" if $@ and ref($@) eq 'My:
    +:Exception';
    
  3. or download this
    use Storable qw/freeze thaw/;
    use MIME::Base64;
    ...
        if( exists $ret->{errorcode} ){  }
      }
    });
    
  4. or download this
    Benchmark: timing 10000000 iterations of die_bliako_way, die_common_se
    +nse, die_common_sense_blessed, no_die...
    die_bliako_way: 56 wallclock secs (55.04 usr +  0.01 sys = 55.05 CPU) 
    +@ 181653.04/s (n=10000000)
    die_common_sense:  5 wallclock secs ( 5.25 usr +  0.00 sys =  5.25 CPU
    +) @ 1904761.90/s (n=10000000)
    die_common_sense_blessed:  5 wallclock secs ( 5.36 usr +  0.00 sys =  
    +5.36 CPU) @ 1865671.64/s (n=10000000)
        no_die:  5 wallclock secs ( 3.77 usr +  0.00 sys =  3.77 CPU) @ 26
    +52519.89/s (n=10000000)