Subject: | 'with_handlers' resets active handlers instead of temporarily adding |
Calls to 'with_handler' don't properly nest, i.e. you can't use
exceptions if some function you call also uses exceptions.
$ cat nest.pl
#!perl
use warnings;
use strict;
use ConditionSystem;
{
package Err;
sub new { bless {}, $_[0] }
}
{
package ErrA;
our @ISA = 'Err';
}
{
package ErrB;
our @ISA = 'Err';
}
with_handlers {
with_handlers {
die ErrA->new;
die ErrB->new;
}
handle(
ErrB => sub {
print "handling ErrB\n";
}
);
die ErrA->new;
}
handle(
ErrA => sub {
print "handling ErrA\n";
}
);
__END__
$ perl nest.pl
handling ErrB
Expected output:
handling ErrA
handling ErrB
handling ErrA