It does sound rather as though you're looking for a way to make a sub force its caller to return. You may be interested, amused, and/or horrified to know that
Want provides an (undocumented) way to do just this. If you call
Want::double_return(), then the next ordinary
return will return
from the calling sub.
For example, the code:
use Want;
sub foo {
print "Entering foo\n";
bar();
print "Leaving foo\n";
return "foo did this";
}
sub bar {
print "Entering bar\n";
print "Leaving bar\n";
Want::double_return();
return "bar did this";
}
print "About to call foo()\n";
my $r = foo();
print "foo() returned '$r'\n";
prints the following:
About to call foo()
Entering foo
Entering bar
Leaving bar
foo() returned 'bar did this'
Update: so in your case, you could write
sub EVENT {
$kernel->post( shift, event => @_ );
Want::double_return();
return;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.