|Perl: the Markov chain saw|
I don't agree, since you blow up the size of the code. That makes it harder to work with quite often.
I had a similar problem once with a hobby project (don't ask).
There were states in a state engine, where the individual states were implemented as methods.
At the start of all the state methods there were some admin code (to unpack parameters) and also when returning (the return values were data structure that told the management system what to do with the next state).
The first part, the in parameter handling, became intolerable. Often the setup was half the code. I should have had some configuration that dynamically generated code, or munged the symbol table, or something.
The ugly extra at the return values were ok. Didn't even look that bad, in the end.
IMHO, what works best is a matter of taste, depending upon the code you add the extra lines to. (-: I would probably bet money that both you and Corion has better taste than me. :-)
In reply to Re^2: How to best pass on the context / wantarray?