develooper Front page | perl.perl6.language | Postings from December 2001

Re: Perl 6's Exporter

Thread Previous | Thread Next
Nicholas Clark
December 24, 2001 08:22
Re: Perl 6's Exporter
Message ID:
On Mon, Dec 24, 2001 at 11:15:55AM -0500, Michael G Schwern wrote:
> On Mon, Dec 24, 2001 at 01:11:21PM +0000, Nicholas Clark wrote:
> > > > 4. For modules, saying 'use Exporter' should be enough to get import.
> > > >    If you don't want Exporter's import(), just C<use Exporter()>.
> > > 
> > > Very nice.  Exporter::Lite does just that.
> > 
> > What actually stops us retrofitting that onto perl5's exporter?
> If we did everyone would still say "@ISA = qw(Exporter)" to be
> backwards compatible, so I don't know what the benefits would be.

None really. Actually, I guess it would make it worse than needing a
prerequisite of Exporter::Lite, as the message:

"import" is not exported by the Exporter module
Can't continue after import errors at -e line 1
BEGIN failed--compilation aborted at -e line 1.

isn't very helpful to a beginner. And unless a newer Exporter ended up
on CPAN (with all the danger of upgrading such a core module) and old copes with core perl exporter not having a VERSION until recently,
it's all a lot more trouble than it's worth.

I guess more effective effort would go into making Exporter's docs clearer.
(for the simple case)

> Also it would cause "subroutine redefined" warnings in this sort of
> code:
>     use Exporter;
>     sub import {
>         ...
>         Exporter::export_to_level(...);
>     }

Not if it's in EXPORT_OK, surely?

Nicholas Clark

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