hubb0r has asked for the wisdom of the Perl Monks concerning the following question:
notation. I attempted to create the dispatch table like:$self->sub($var);
and I actually tried a few other notations along the same lines. Each run would result in the value of the hashkey to be undef. The only way I was able to make this work was with an explicit package name like so:my %message_types = ( type1 => \&{$self->sub_1}, type2 => \&{$self->sub_2}, );
The question is, is it possible to use the $self->sub notatation to do this? My assumption was that it was, but you know what they say about assumptions... I'd really rather use the self referencing notation as it looks much cleaner and is much more readable. Thanks for your help!!my %message_types = ( type_1 => \&MY::Fully::Qualified::Package::Name::sub1, type_2 => \&MY::Fully::Qualified::Package::Name::sub2, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dispatch table within package question
by ikegami (Patriarch) on Jan 26, 2005 at 17:39 UTC | |
by hubb0r (Pilgrim) on Jan 26, 2005 at 18:00 UTC | |
by loris (Hermit) on Oct 07, 2005 at 09:25 UTC | |
by ikegami (Patriarch) on Oct 07, 2005 at 14:55 UTC | |
by loris (Hermit) on Oct 14, 2005 at 06:59 UTC | |
|
Re: Dispatch table within package question
by Aristotle (Chancellor) on Jan 26, 2005 at 17:44 UTC | |
|
Re: Dispatch table within package question
by bpphillips (Friar) on Jan 26, 2005 at 17:55 UTC | |
by chromatic (Archbishop) on Jan 26, 2005 at 21:53 UTC | |
by bpphillips (Friar) on Jan 27, 2005 at 13:33 UTC |