>>>>> "KG" == Kenneth Graves <[EMAIL PROTECTED]> writes:
KG> The following (somewhat ugly) code works:
KG> return $Quizzer::Attempt::{$name}->($self)
KG> if $Quizzer::Attempt::{$name} && \&{$Quizzer::Attempt::{$name}};
KG> Any way to make it prettier? I'm especially offended by the \&{}.
<untested>
$func = *{$Quizzer::Attempt::{$name}}{CODE} and return $func->($self) ;
you can't put my in front and do that in one line.
KG> --kag (who is overly fond of dispatch tables)
so why not use your own instead of messing with typeglobs? with globs
you have to deal with an extra level to get the code part. with your own
table you know the value is a code ref and the whole thing is simpler
and cleaner.
uri
--
Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org