Uri Guttman wrote:
>>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:
> 

> i told you dispatch tables are very useful!
> 
> i leave how to code it as an exercise for you.

Well, I did end up implementing the dispatch table, and had some serious
problems trying to retrofit it into a particular class's namespace, but
it's done.

Quickly I found that I was copy/pasting the way I did it, and will have
two spots to make changes, but was able to do it without making any API
changes. Even though I continued on to completion for experience, I
realized that what I should be doing is configuring the 'struct'
definitions themselves as the dispatch table (which I will proceed to do).

My type definitions are a hash, where the key is the 'tag', and the
value is a human-presentable description of the tag. I figure that if I
make the 'description' contain a coderef to the validation directly,
I've saved much time, and held true to the primary programmer virtue,
all the while not needing to make any API changes.

I have a semi-related code question that has to do with the tightening
of param validation.

In my ISP::Vars class, I have a compare() method, which now checks for
extra, _and_ missing 'tags'. I've compiled in a config var that I can
use while building the gui that states:

[ISP::Vars]
forgive_missing_attrs   = 1

I want to add the ability for a 't/*.t' test to either disable this
check, or implement some form of "IM_A_TEST" variable into the ISP::Var
namespace without having to modify the config file itself.

I'm sure this is a symbol table thing, but as always, loose direction
that will lead me to further reading is welcome ;)

Steve

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to