Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: "Dynamic" dispatch tables

by chromatic (Archbishop)
on Apr 29, 2011 at 21:06 UTC ( [id://902076]=note: print w/replies, xml ) Need Help??


in reply to Re: "Dynamic" dispatch tables
in thread "Dynamic" dispatch tables

I'm not sure why you're using a dispatch table here...

The table offers slightly more security, in that there's no possibility of unguarded user input somehow selecting an inappropriate function.

Even so, namespacing as you've done ameliorates that somewhat.

Replies are listed 'Best First'.
Re^3: "Dynamic" dispatch tables
by sundialsvc4 (Abbot) on Apr 29, 2011 at 22:41 UTC

    In this case, I cordially suggest that the concern is not “the use of dispatch-tables per se,” but the authentication that must take place to confirm that a particular dispatch-table entry may be used.

    When I construct dispatch tables, I usually employ a hashref where each element points to another hashref with several entries in it.   One of these of course is a reference to the sub that must be called to do the work.   Others may be to subs that serve as parameter-validators and security checkers ... you can get as fancy as you like, even setting up arrays of these subroutine references.

    And then, when the target routine actually does get control, it, too, I believe, has the same duty to check once again that it is being called under appropriate conditions.   (Those checks can be simpler, since they basically serve to double-check that the dispatcher is doing its job.)   Only requests that have been scrutinized several times, by code that exists in several different places, actually get carried out.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://902076]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-18 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found