On Thu, May 10, 2001 at 05:49:56PM +0200, Andreas J. Koenig wrote:
> perl-5.6.1 has this:
>
> =head1 NAME
>
> autouse - postpone load of modules until a function is used
>
> =head1 SYNOPSIS
>
> use autouse 'Carp' => qw(carp croak);
> carp "this carp was predeclared and autoused ";
Yes, I remember trying to get autouse to work usefully a while back.
Never quite did.
The intents of AnyLoader and autouse are very similar, but the
mechanism is a bit different (autoloader vs magic function stubs).
autouse has piles of caveats: autoused module must use
Exporter->import; you can't meaningfully autouse two functions from
different modules with different names). So does AnyLoader, but
they're different caveats.
autouse also throws some annoying warnings:
$ perl -wle 'use autouse "Carp" => qw(croak); print croak("foo")'
Subroutine croak redefined at /usr/local/lib/perl5/5.6.1/autouse.pm line 57.
foo at -e line 1
whereas AnyLoader does not (it surpresses the expected ones)
$ perl -wle 'use AnyLoader; print Carp::croak("foo")'
foo at -e line 1
Also, the feature sets are a bit different. AnyLoader is universal
(it only has to be used once anywhere and its in effect everywhere)
and you don't have to predeclare what you want anyloaded (though you
can).
So there's enough differences, I'd think, to let AnyLoader in. It was
originally written as "Hey, UNIVERSAL::AUTOLOAD, that's a neat idea!"
I'll remember to put autouse into AnyLoader's SEE ALSO though.
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
There is nothing wrong. We have taken control of this sig file. We will
return it to you as soon as you are groovy.