[Chicago-talk] A question of 'die'ing

Michael D. Stemle, Jr. manchicken at notsosoft.net
Tue Jan 30 09:02:31 PST 2007


On Monday 29 January 2007 18:23, Shawn Carroll wrote:
> What are your thoughts on a library that will die if it is given
> invalid input?  Would use such a library if it required you to put
> eval blocks around it each time?

Take a look at Error.pm.  Exceptions are easilly handled with `use Error 
qw{:try}`.  You even then get the syntactic sugar of try/catch blocks.  
Consider the following:

sub foo {
  try {
    die "foo";
  } otherwise {
    my $err = shift;
    printf ("Got error: %s\n", $err->stringify());
  };
}

-- 
~ Michael D. Stemle, Jr. <><
(A)bort, (R)etry, (I)nfluence with large hammer
The number of the beast - vi vi vi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20070130/467c5e40/attachment.bin 


More information about the Chicago-talk mailing list