good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
creating an altered clone of a Moose object for a limited scopeby metaperl (Curate) |
on Jul 09, 2011 at 11:10 UTC ( [id://913505]=perlquestion: print w/replies, xml ) | Need Help?? |
metaperl has asked for the wisdom of the Perl Monks concerning the following question:
In the second code sample below, package LM has a subroutine mylol. In this subroutine, the object slot data is manually changed from it's initialized value and then set back to the original value before the subroutine exits.
I was hoping to use lexical scope or something to avoid manually setting the value back to its original value: but I didnt like the idea of using package variables to achieve it. Is there some way to create a scope and change an object and then have it pop back to the initial settings?
The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development. -- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"
Back to
Seekers of Perl Wisdom
|
|