Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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?
[LanX]: I can imagine ...
LanX hurts to be bitten between the legs ;-)
[holli]: You see, I have a friend whose daughter has been damaged seriously because she wasn't vaccinated against measles. (Her mother being anti-vaxx).
[LanX]: Contrary to Olivia newton John I don't like physical confrontations ...
[LanX]: Oh, you spread measles in your saliva?
[LanX]: ... and why did you bite hos daughter?
[LanX]: *his
[holli]: And this guy was also Anti-Vaxx and I just snapped. I shoed him all over the yard
[james28909]: biting between the legs? now thats my kind of religion.
[holli]: and back into the building, saw him later peeking out of the window looking scared. It was hilarious.

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2017-12-13 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (373 votes). Check out past polls.

    Notices?