On Nov 12, 2005, at 4:12 PM, Randal L. Schwartz wrote:

"Ken" == Ken Williams <[EMAIL PROTECTED]> writes:

Ken> You want:

Ken> eval "$subroutine_name(\$hashref)";

Only if you also want "slow" and "dangerous'.  See the other answers
in this thread for safer faster solutions.

Yeah, I know, but I posted it because I didn't really like the other solutions; while they use "better" (and more complicated) techniques, they won't actually solve the OP's problem. The "pretend you have methods instead of subroutines" solution is just wishful thinking, and the "dispatch tables" solution seems overengineered and won't work unless the specific list of allowed functions (rather than just a naming-scheme pattern or similar) is known to the dispatcher.

As it turns out, I already had a list of allowed functions because I didn't want to be eval'ing things from the text files and have it error out (as I knew I would be building the functions over time and I know I will always be missing some as there are potentially thousands of them--each represents a Lego brick...). So the dispatch table worked fine.

Thanks!

--

Thanks,

James Reynolds
University of Utah
Student Computing Labs
[EMAIL PROTECTED]
801-585-9811

Reply via email to