http://qs321.pair.com?node_id=792434


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.