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

Re: Is it possible to call a package::main subroutine from a module?

by BrowserUk (Patriarch)
on Mar 21, 2016 at 22:11 UTC ( [id://1158464]=note: print w/replies, xml ) Need Help??


in reply to Is it possible to call a package::main subroutine from a module?

Does this help?

{ package x; my $subref; sub set{ $subref = shift }; sub call{ $subref->( @_ ) }; };; sub test{ print "This is sub test() with args:[ @_ ]"; };; x::set( \&test );; x::call( 1, 2.0, 'three' );; This is sub test() with args:[ 1 2 three ]

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Is it possible to call a package::main subroutine from a module?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-23 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found