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

Re: [PATCH] making Exporter simpler to use

Thread Previous
From:
Fergal Daly
Date:
February 11, 2003 10:43
Subject:
Re: [PATCH] making Exporter simpler to use
Message ID:
200302111844.12263.fergal@esatclear.ie
On Tuesday 11 February 2003 17:56, John Peacock wrote:
> I like it in theory, though I admit I haven't tried to use it in practice
> yet.
>
> There is a typo though:
> > +by hand use C<require Exporter> or you can use C<use Expoerter (ARGS)>
> > to
>
> +by hand use C<require Exporter> or you can use C<use Exporter (ARGS)> to

Thanks.

> How does this differ from what you posted yesterday?

It's diffed against the latest Exporter.pm and Exporter.t rather than the 
5.8.0 versions and it adds the ALL feature...

use Exporter (
	EXPORT => [ qw( a b c d )],
	OK => [ qw(e f g h ) ],
	ALL => 'everything',
);

will result in

@EXPORT = qw( a b c d );
@EXPORT_OK = qw( a b c d e f g h);
%EXPORT_TAGS = (
	everything => [ qw( a b c d e f g h )],
);

Many modules export some sort of  tag containing all the symbols, this allows 
that tag to be built automatically.

Finally, my code is now in a subroutine so the patch hardly touches any old 
code at all.

It's actually the the simple case that annoys me most where 3 out of 4 lines 
are just boilerplate code that goes with every use of Exporter

F

-- 
Do you need someone with lots of Unix sysadmin and/or lots of OO software 
development experience? Go on, giz a job.
My CV - http://www.fergaldaly.com/cv.html


Thread Previous


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