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

Re: [PATCH] making Exporter simpler to use

Thread Previous | Thread Next
From:
Fergal Daly
Date:
February 11, 2003 17:13
Subject:
Re: [PATCH] making Exporter simpler to use
Message ID:
200302120115.51006.fergal@esatclear.ie
On Wednesday 12 February 2003 01:15, Brent Dax wrote:
> No, John interpreted correctly.  I'm worried about people using this
> feature without realizing that it's not backwards-compatible[1].

Yes, I know, hence my first reaction included the idea of putting something in 
the docs saying not to use it if you want your module to be usable with older 
versions of Perl. I agree that this is an issue.

My counterpoint was that that shouldn't stop the builtin modules taking 
advantage of it and it shouldn't stop anyone else who doesn't care about 
other people using their modules either.

> My idea of an 'easiest' exporter interface is something like:
>
> 	use Exporter::Easiest
> 		':default' => qw(foo),
> 		':all'     => [qw(bar baz quux)], #Not needed but OK
> 		':tag1'    => qw(bar baz),
> 		':tag2'    => qw(:tag1 foo);

How do you distinguish between
':a' => qw( b :c),
'd' => qw( :e f )

and

':a' => 'b',
:c => 'd',
'e' => 'f '

They both flatten down to qw(:a b :c d :e f).

However I could make it do this:

use Exporter::Easiest q(
        OK => munge frobnicate
        EXPORT => :tag1
        :tag1 => a b c
        :tag2 => :tag1 d e f
        FAIL => f g h
);

no need for the TAGS key anymore

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 | 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