The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more
|
#!perl
sub test : event_cb { }
sub test : event_cb(-1000) { die }
sub test : event_cb(1000) { }
my $f = foo3->new;
my $died ;
$f ->set_exception_cb ( sub {
$died ++;
});
$f ->test;
ok ( $died , "got exception from method" );
my $warn ;
$SIG {__WARN__} = sub {
$warn = $_ [0];
};
$f ->set_exception_cb ( sub {
$f ->test;
});
$f ->test;
ok ( $warn =~ /recursion/, "got exception callback recursion" );
$warn = undef ;
$f ->set_exception_cb ( sub {
$f ->event ( 'test' );
});
$f ->event ( 'test' );
ok ( $warn =~ /recursion/, "got exception callback recursion via event method" );
|