Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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.

Replies are listed 'Best First'.
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 lurking in the Monastery: (3)
As of 2016-09-29 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (547 votes). Check out past polls.