Sorry, but I don't see why (on its own) this is a bad idea. If @callbacks is under your complete control and you know that all your callback subs behave according to some set of rules then I see little wrong with it. If however @callbacks is not under your control then you have a different issue. At that point I would recommend a series of checks:
I'm sorry, but given the amount of information you have supplied here, I don't really see what you are trying to get at. Callbacks are a common enough idiom, but when used loosly they can be dangerous, but if you really wanna go there then you could say that plain old assignment (=) is dangerous.foreach my $callback (@callbacks) { (ref($callback) eq "CODE") || die "$callback is not a code ref"; my @temp_args = @{[@args]}; $callback->(@temp_args); if (verify(@temp_args)) { @args = @temp_args; } else { die "callback did something funky to args"; } }
Please provide a bit more information on the code, and how things like @callbacks and @args get populated, along with maybe a bit more context as to where this all gets executed.
-stvnIn reply to Re: Action at a great distance
by stvn
in thread Action at a great distance
by sfink
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |