in reply to method dispatch question
Once you have a reference to a method, the following notations are perfectly equivalent:
In this case, in fact, usual OOP stuff for hereditariness does not kick in, because perl already has a method to call.$mref->($self); # OR $self->$mref();
I agree with moritz about avoiding syntaxes that go beyond readability. On the other hand, I think that the following remains inside the realm of readability:
although I'd probably go for a temporary variable anyway, just to stress the fact that you're getting a method to call on $self.$self->get_mref(...)->($self);
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
Io ho capito... ma tu che hai detto?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: method dispatch question
by ysth (Canon) on Jul 10, 2008 at 09:52 UTC | |
by parv (Parson) on Jul 10, 2008 at 10:07 UTC | |
by polettix (Vicar) on Jul 10, 2008 at 11:11 UTC | |
by ysth (Canon) on Jul 10, 2008 at 15:44 UTC |
In Section
Seekers of Perl Wisdom