Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Style - how to give class method call as parameter

by Athanasius (Abbot)
on Jun 26, 2012 at 13:40 UTC ( #978425=note: print w/ replies, xml ) Need Help??


in reply to Style - how to give class method call as parameter

Number 3a:

my $success = $self->do_sub_with_timeout( $deployer->extend_order_leas +e( $order, $end_date ), $timeout );

But there’s nothing wrong with Number 1.

Update: Seems I missed the point of the question. Thanks to Boldra and choroba for pointing out that my ‘solution’ preempts the timeout.

Athanasius <°(((><contra mundum


Comment on Re: Style - how to give class method call as parameter
Download Code
Re^2: Style - how to give class method call as parameter
by Boldra (Deacon) on Jun 26, 2012 at 13:44 UTC
    That's not going to work, extend_order_lease will be executed before do_sub_with_timeout gets called, so there'll be no chance for it to interrupt.

    OP: How much code is in do_sub_with_timeout? Since the subroutine/method call is making it less readable, maybe there's no benefit in putting it in a subroutine? Maybe what you really want is a sub like handle_timeout which gets called if the timeout is exceeded.

Re^2: Style - how to give class method call as parameter
by choroba (Canon) on Jun 26, 2012 at 13:50 UTC
    That's not the same. You are calling the method, not passing a reference to it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-07-05 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls