go ahead... be a heretic | |
PerlMonks |
(tye)RE: access to my variables from other subsby tye (Sage) |
on Oct 21, 2000 at 10:11 UTC ( [id://37787]=note: print w/replies, xml ) | Need Help?? |
Eval-ing each time works ok, but it is molasses slow. You don't have to use eval in order to create a new closure. As I recently pointed out, creating a closure doesn't even recompile the subroutine. So I wonder if your concern about speed is based on benchmarks or just an expectation on your part. The drawback to the passing the variables is that is no longer quite as easy as envisioned: If you decide to display a new variable, you can't just change your template and be done, you now must change the code that passes in the hash or hashref to the display function. A real code example would sure go a long way here. There are lots of ways to build something that knows about a lexical variable. I have a hard time imagining why passing in \%hash explicitly is such a hardship, but that is probably because I haven't seen any code that really shows what you are trying to do -- just the abstract problem that you think should be the solution.
Okay, are any of those silly enough for you? (: - tye (but my friends call me "Tye")
In Section
Seekers of Perl Wisdom
|
|