Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Tweaking 'return'.

by ikegami (Patriarch)
on Nov 22, 2005 at 21:48 UTC ( [id://510929]=note: print w/replies, xml ) Need Help??


in reply to Tweaking 'return'.

I can't remember what it's called, but there's a module that wraps a function call with pre and post handlers. Sounds perfect if you want to do this for a few functions.

Update: I found Hook::PrePostCall, but I think there's another one. I haven't used either.

Replies are listed 'Best First'.
Re^2: Tweaking 'return'.
by fishbot_v2 (Chaplain) on Nov 22, 2005 at 22:10 UTC
    ...but I think there's another one...

    There is Hook::LexWrap:

    use Hook::LexWrap; wrap( $_, pre => sub { print "$_ begin\n" }, post => sub { print "$_ end\n" }, ) for @subs_to_wrap;

    Updated example to be more inline with OP's requirements.

Re^2: Tweaking 'return'.
by jdporter (Paladin) on Nov 23, 2005 at 16:18 UTC
    ... I think there's another one.

    There's also Hook::WrapSub:

    use Hook::WrapSub qw( wrap_subs ); wrap_subs( sub { print "before $Hook::WrapSub::name (@_)\n" }, @subs_to_wrap, sub { print "after $Hook::WrapSub::name (@Hook::WrapSub::result)\n" +} );
    We're building the house of the future together.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-24 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found