develooper Front page | perl.perl5.porters | Postings from November 2003

Re: DynaLoader (was Re: [5.12.0] Proposal for changing UNIVERSAL semantics)

Thread Previous | Thread Next
Graham Barr
November 6, 2003 11:32
Re: DynaLoader (was Re: [5.12.0] Proposal for changing UNIVERSAL semantics)
Message ID:

On Nov 6, 2003, at 2:00, Michael G Schwern wrote:

> On Wed, Nov 05, 2003 at 09:05:52PM +0000, Graham Barr wrote:
>> On Nov 4, 2003, at 23:13, Michael G Schwern wrote:
>>> So, basically, you pick up an AUTOLOAD by inheriting from any module
>>> that
>>> uses XS.  Feeling paranoid yet? :)  Should we change can() to ignore
>>> methods inherited from DynaLoader now?
>> Thats been a known issue for a long time. The only reason you need to
>> inherit from DynaLoader is that bootstrap may call the dl_load_flags
>> method.
> Are you sure you mean dl_load_flags?  It appears that the autoloaded
> methods are:

What has autoloaded subs got todo with inheritance ?

> dl_findfile
> dl_expandspec
> dl_find_symbol_anywhere

These are all called as subs, not methods

dl_load_flags is the only method called by the code in DynaLoader so 
that modules can override it.

> I wonder if autoloading these 135 lines of code is really saving us
> anything worth the trouble of accidental AutoLoader inheritence.

This whole thing of DynaLoader using AUTOLOAD has been looked at before 
in the past. And I am sure there was a reason why it was done this way. 
I just cannot remember.

>> The annoying thing is that because you do have AUTOLOAD there then you
>> get different warnings.
> I've been pondering changing the AutoLoader error message so it looks
> a bit more like a normal method/function lookup failure.  Possibly
> placing the normal error in front of the extended AutoLoader 
> information.
> This way at least checks like
> $@ =~ /^Can't locate object method "$meth" via package "$class"/ will
> still work.

But AutoLoader::AUTOLOAD has no way to be sure if what is being 
attempted to be loaded was called as a method or a sub


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About