in reply to Re: Trying to get around the "use strict 'refs'" Issue
in thread Trying to get around the "use strict 'refs'" Issue

Seems like a dispatch table is the way to go.

To use the dispatch table, I'll have to modify both the table and add the subroutine instead of just adding a new routine to my program

However, as you pointed out, what if someone defined a nefarious routine? My program would simply do it's little check, notice the "checkCauseMayhem" and go on its merry way.

  • Comment on Re^2: Trying to get around the "use strict 'refs'" Issue

Replies are listed 'Best First'.
Re^3: Trying to get around the "use strict 'refs'" Issue
by chromatic (Archbishop) on May 07, 2007 at 18:27 UTC
    However, as you pointed out, what if someone defined a nefarious routine?

    If someone malicious has access to your computer so as to be able to modify the code of any program you deem important, you have greater worries than said person modifying the code of any program you deem important.

Re^3: Trying to get around the "use strict 'refs'" Issue
by blazar (Canon) on May 07, 2007 at 18:48 UTC
    However, as you pointed out, what if someone defined a nefarious routine? My program would simply do it's little check, notice the "checkCauseMayhem" and go on its merry way.

    That's just the same with your previous approach. The only difference being that in one case you use a generic hash and make it specialized for this task. In the other one, a very specific one -the stash-, designed to do something completely different.