Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Passing subroutine as argument between packages

by chromatic (Archbishop)
on Nov 30, 2011 at 18:25 UTC ( #940917=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Passing subroutine as argument between packages
in thread Passing subroutine as argument between packages

Given:

my $ref = sub { $FooConfig->important_func( '1', @_ ) };

... then you can write:

$ref->( 'more', $args, %here );

... though be cautious and understand how the function reference passes its arguments to the inner function.


Improve your skills with Modern Perl: the free book.


Comment on Re^3: Passing subroutine as argument between packages
Select or Download Code
Re^4: Passing subroutine as argument between packages
by Mateusz (Initiate) on Nov 30, 2011 at 18:43 UTC

    Simple @_ is solution - now works fine!

    Thanks for very helpfull hints.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-07-14 10:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls