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

Re: How to best pass on the context / wantarray?

by demerphq (Chancellor)
on Mar 27, 2006 at 16:30 UTC ( #539477=note: print w/ replies, xml ) Need Help??


in reply to How to best pass on the context / wantarray?

Context propagates.

sub handle_mutator { my ($self,$cb)=@_; my $obj; if (defined wantarray) { $obj = $self->copy(); } else { $obj = $self; }; $cb->($obj,@_); } sub something { shift->handle_mutator(sub{ .... }); }
---
$world=~s/war/peace/g


Comment on Re: How to best pass on the context / wantarray?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2014-12-21 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls