My base class reads in a config, and does the following. BEGIN { # global variables
my @global_vars = qw ( GLOBAL_STACK_TRACE PROFILING CODE_PATHS CONFIG_DIR ACCT_APP DB_SOURCE DB_USER DB_PASS ); for my $member (@global_vars) { no strict 'refs'; *{$member} = sub { my $self = shift; return $self->{config}{$member}; } } } The config file also has directives for each child class, which the base carries in a configure() method. The child has a similar BEGIN. The child may have attributes that are ro, so the subs assigned in the symbol table to the config directive are not all the same. I want to add functionality to *each* of the *$members instead of having them act as a simple directive. If I understand correctly, even though Perl is interpreted, the compilation only happens once (until the object goes away), so I'd like to keep this type of functionality within BEGIN blocks. I want to test the waters of dispatch tables and callbacks by having my code create it's own logic diagram (well, in text that is). The call would belong in the base class, so everyone can see it, and I figure initially that I'd have each child call the base method, if the config var exists (at this point, all children carry their own config in themselves). Well, enough with the description..what I want to know is whether the code I have above that modifies the symbol table could be classified as a compile-time symbol table dispatch table? Is doing it this way reliable? Any issues I may run into? I like this, because I wouldn't have to pass around the dispatch table...it would be inherent. Steve
smime.p7s
Description: S/MIME Cryptographic Signature