good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Re: Re: Automating dispatch tablesby dragonchild (Archbishop) |
on Apr 16, 2004 at 11:52 UTC ( [id://345729]=note: print w/replies, xml ) | Need Help?? |
In some cases you do need the power of a hash based dispatch, for instance if you wanted to assign a "security level" required to execute each sub, or complicated things of that nature. But for just doing quick "switch" type dispatches, this way is much faster to type and easier to maintain.
Uhhh ... that's not quite right. If you're going to go to all the trouble of actually making a new package and a new file (cause, you might as well make these shareable!), then you'd probably also add a security function somewhere. I would envision something like:
Now, to correct a misconception - without serious craziness of the Devel:: variety, you cannot access a lexically scoped variable outside its scope. Period, Do Not Pass Go, End Of Story. In other words, it's not an issue. This goes for packages or closures. (That's kinda why they're called "closures".) ------
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
In Section
Meditations
|
|