in reply to Style - how to give class method call as parameter
Personally, I like number three best, but as an alternative, you can wrap number three in some syntactic sugar:
sub transaction(&$$) { my ($cb, $self,$timeout) = @_; $self->do_sub_with_timeout( $cb, $timeout ); }; transaction { $deployer->extend_order_lease( $order, $end_date ); } $self, $timeout;
Unfortunately, the & prototype must come as the first argument. I'm also not convinced that this style is less confusing/more readable than the other.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Style - how to give class method call as parameter
by strat (Canon) on Jun 26, 2012 at 18:23 UTC |