Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Alternative ways to fully qualify subroutine names

by dakkar (Hermit)
on Feb 05, 2006 at 14:26 UTC ( #528069=note: print w/ replies, xml ) Need Help??


in reply to Alternative ways to fully qualify subroutine names

Apart from using can (which is a great way), you can also do:

package A; sub b { print "called A::b\n"; } package main; my $pack='A'; { no strict 'refs'; &{"${pack}::b"}(); }

That is, creating a soft-ref to the sub on-the-fly.

-- 
        dakkar - Mobilis in mobile

Most of my code is tested...

Perl is strongly typed, it just has very few types (Dan)


Comment on Re: Alternative ways to fully qualify subroutine names
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2015-07-06 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls