Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?

by ikegami (Pope)
on Aug 31, 2009 at 19:05 UTC ( #792434=note: print w/replies, xml ) Need Help??


in reply to A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?

A trick that's useful in some circumstances is to declare the subs to be autoloaded.

$ perl -le' sub AUTOLOAD { print "Loading $AUTOLOAD" } sub foo; __PACKAGE__->can("foo")->(); ' Loading main::foo

(Oops, already covered.)

  • Comment on Re: A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?
  • Download Code

Replies are listed 'Best First'.
Re^2: A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?
by SilasTheMonk (Chaplain) on Aug 31, 2009 at 19:52 UTC
    Yeah. If I could predict or control what functions can be used I would not autoload. Generally you can so I think autoloading should be rare. Where I have found it useful is in enabling much looser coupling.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://792434]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2018-07-18 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (383 votes). Check out past polls.

    Notices?