Is it possible for a Perl subroutine to force its caller to return?
- by Kinopiko
If I have Perl module like
package X;
and an object like
my $x = X->new ();
Inside X.pm, I write an error handler for $x called handle_error, and I call it
sub check_size
{
if ($x->{size} > 1000) {
$x->handle_error ();
return;
}
}
Is there any way to make handle_error force the return from its caller routine? In other words, in this example, can I make handle_error do return in check_size without actually writing return there?