[cgiapp] can AUTOLOAD sub be named AUTOLOAD?

rjmorris12 at gmail.com rjmorris12 at gmail.com
Wed Apr 16 12:10:51 EDT 2008


Perrin Harkins <perrin at elem.com> wrote on Wed, Apr 16, 2008 at 11:48:42AM -0400:
> I have no idea if it's a bug or not, but a sub called AUTOLOAD has a
> well-known meaning in Perl which you are not entirely following here,
> and that seems very confusing to me.  It's kind of like wanting to
> call your custom cleanup method DESTROY.

The problem is that I didn't choose the name AUTOLOAD for the run mode. It's
the name required by CGI::Application. From the docs:

  If CGI::Application is asked to go to a run mode which doesn't exist it will
  usually croak() with errors. If this is not your desired behavior, it is
  possible to catch this exception by implementing a run mode with the
  reserved name "AUTOLOAD"

So to make use of the AUTOLOAD functionality in CGI::Application, I cannot
give my AUTOLOAD sub the same name as the run mode (unless this is a bug).
Thus I lose the advantages (however small) such a set up might have offered
me. Perhaps it would have been better to reserve a name other than AUTOLOAD
for this purpose. I don't know all the details and haven't considered other
contexts, so I can't say.


More information about the cgiapp mailing list