in reply to Action at a great distance
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.
-stvn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Action at a great distance
by Aristotle (Chancellor) on Mar 20, 2004 at 08:07 UTC | |
by stvn (Monsignor) on Mar 20, 2004 at 14:38 UTC | |
by Aristotle (Chancellor) on Mar 20, 2004 at 14:58 UTC | |
by stvn (Monsignor) on Mar 20, 2004 at 16:18 UTC | |
by Aristotle (Chancellor) on Mar 20, 2004 at 18:02 UTC | |
| |
|
Re^2: Action at a great distance
by Aristotle (Chancellor) on Mar 20, 2004 at 17:30 UTC | |
by stvn (Monsignor) on Mar 20, 2004 at 17:41 UTC |