Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the AutoLoader CPAN distribution.

Report information
The Basics
Id: 31031
Status: resolved
Priority: 0/
Queue: AutoLoader

People
Owner: Nobody in particular
Requestors: gbarr [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: perl5-porters [...] perl.org, bug-AutoLoader [...] rt.cpan.org
Subject: Re: AutoLoader slowness in "can"
Date: Wed, 28 Nov 2007 06:29:43 -0600
To: Steffen Mueller <l2ot9pa02 [...] sneakemail.com>
From: Graham Barr <gbarr [...] pobox.com>
On Nov 28, 2007, at 2:45 AM, Steffen Mueller wrote: Show quoted text
> Hi p5p, > > I just received the following bug report for AutoLoader from Slaven > Rezic. > > Apparently, AutoLoader > 5.60, $obj->can("foo") tries to autoload the > foo method. (Given that the package of $obj uses AutoLoader's > AUTOLOAD.) > > Slaven points out that this inflicts a stat() call, which is > suboptimal. > If I find some time today, I'll investigate this, but I can't make any > promises. I'm not sure Slaven's proposed patch is a good solution at > first sight. Any input is appreciated.
I do not see the point of AutoLoader::can A module that uses the AutoLoader package should be installed using the AutoSplit package. The result will be that sub stubs will be created for every method/sub that is to be AUTOLOADed. This will cause the default ->can method in UNIVERSAL to return a reference to the sub stub. When the method is called it will get loaded. AutoLoader::can does call SUPER::can first and return if that is true, so the code in AutoLoader::can will only ever do its checking if the package that is using AutoLoader was not installed correctly with AutoSplit or the method being requested does not exist. Show quoted text
> The root of the problem is that the "require" in AutoLoader::can is > called every time. A possible fix is to fake %INC so that require is > called only once. See the attached patch.
IMO, AutoLoader::can should just be removed all together. Graham.
Finally, this bug should be fixed by AutoLoader 5.65. can is now history.