in reply to Storing/Calling References to Instance Methods
That puts one extra subroutine call on the stack though. If you have anything that is stack-sensitive (calls caller, for example), you'll need to use a goto to get rid of that extra hop:$md_config->{"[cust_num]"} = sub { $web_services->GetCustomerNumber(@_ +) };
$md_config->{"[cust_num]"} = do { my $meth = $web_services->can("GetCustomerNumber"); sub { unshift @_, $web_services; goto &$meth; } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Storing/Calling References to Instance Methods
by mlong (Sexton) on Sep 20, 2007 at 16:38 UTC | |
by ikegami (Patriarch) on Sep 20, 2007 at 16:40 UTC |