Why did you make 'class' a member variable in $fields{'class'}? You already had access to it in $class and I think that since it is not member data that it shouldn't be treated that way.

Please also note that I wrote Stealing lexicals - best practice suggestions with the idea of violating the sort of encapsulation you just proposed here. Nothing is absolute. The code I've seen that really, truely encapsulates is Protect your subs... from *EVIL*.. This assumes the idea of "encapsulation" means "Prevent a determined programmer who is willing to write unmaintainable code from gaining access to private variables" and not "Prevent a normal programmer from gaining access accidentally or otherwise."

In reply to Re: May Thy Closures Be Blessed by diotalevi
in thread May Thy Closures Be Blessed by hardburn

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":