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

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

Thread Previous | Thread Next
From:
Graham Barr
Date:
November 5, 2003 13:06
Subject:
DynaLoader (was Re: [5.12.0] Proposal for changing UNIVERSAL semantics)
Message ID:
D705AE34-0FD3-11D8-BBC1-0003938857CC@pobox.com
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.

The annoying thing is that because you do have AUTOLOAD there then you 
get different warnings.

Thats why in the past I have done

{
   require DynaLoader;
   local @ISA = qw(DynaLoader);
   bootstrap List::Util $XS_VERSION;
}

to bootstrap a module.

If the following in DynaLoader.pm was changed from

     my $libref = dl_load_file($file, $module->dl_load_flags) or
         croak("Can't load '$file' for module $module: ".dl_error());

to

     my $dl_load_flags = $module->can('dl_load_flags') ? 
$module->dl_load_flags : 0;
     my $libref = dl_load_file($file, $dl_load_flags) or
         croak("Can't load '$file' for module $module: ".dl_error());

and export bootstrap, there would be no need to inherit from DynaLoader

Graham.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About