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


in reply to Am I asking for trouble with my own AUTOLOAD sub?

I'm wondering if there is something I'm not anticipating. Is there a problem with this approach that I don't see or am I just paranoid?

A bit of paranoia can be healthy.

One of the more robust and interesting AUTOLOADs I've seen is in CGI.pm (actually, in CGI::_compile, which CGI::AUTOLOAD delegates to). I recommend it for careful study. It shows a few edge cases that many examples don't cover.

I see that your AUTOLOAD doesn't actually introduce any new symbols in a package's namespace. Rather, it's just a backstop that make indirect subroutine calls. Is this what you intended?

Replies are listed 'Best First'.
Re: Re: Am I asking for trouble with my own AUTOLOAD sub?
by CharlesClarkson (Curate) on Feb 02, 2002 at 04:50 UTC

    Rather, it's just a backstop that make indirect subroutine calls. Is this what you intended?

    Yes, I originally wrote the AUTOLOAD for Address.pm and thought, "Hey, I could stick this in a base class and use it to supply automatic methods for other classes as well." Extending Laziness with OO.




    HTH,
    Charles K. Clarkson