Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: method dispatch question

by rafl (Friar)
on Jul 09, 2008 at 12:35 UTC ( #696443=note: print w/ replies, xml ) Need Help??

in reply to Re^2: method dispatch question
in thread method dispatch question

Can this still be written in one line, without intermediate variable $mref?
$self->get_mref->($self, @args);

or make get_mref return a code reference that captured $self so you can omit it when calling it.

sub get_mref { my ($self) = @_; my $coderef = \&some_method; return sub { $self->$coderef(@_) }; } $self->get_mref->(@args);

Comment on Re^3: method dispatch question
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://696443]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2015-11-28 13:56 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (742 votes), past polls