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

RE: [PATCH] making Exporter simpler to use

Thread Previous | Thread Next
From:
Brent Dax
Date:
February 11, 2003 10:43
Subject:
RE: [PATCH] making Exporter simpler to use
Message ID:
007201c2d200$2ad7bd90$7b01a8c0@deepblue
Fergal Daly:
# If accepted this patch will allow hundreds of lines of fiddling with 
# EXPORT_BLAH to be deleted from Perl modules.
# 
# The patch barely touches the original code and is totally backwards 
# compatible. All it does is give a nice way to set up @EXPORT 
# and all the 
# others without have to explicitly mention them.
# T
# his time I diffed against the latest version of Exporter - 
# 5.567. The patch 
# includes tests and doc changes.
# 
# In it's simplest case it allows you to replace
# 
# require Exporter;
# use base qw( Exporter );
# use vars qw( @EXPORT );
# @EXPORT = qw( init );
# 
# with
# 
# use Exporter ( EXPORT => [qw( init )] );

My big problem with this patch is that this is a *huge* interface
change.  I'm worried about how hard this will fail if you use a module
with an older Perl (is there a word for this?):

	C:\>perl -we "use Exporter ( EXPORT => [qw( init )] )"
	"EXPORT" is not exported by the Exporter module at -e line 1
	"ARRAY(0x1ab29c4)" is not exported by the Exporter module at -e
line 1
	Can't continue after import errors at -e line 1
	BEGIN failed--compilation aborted at -e line 1.

It doesn't fail silently, but it's not exactly friendly either.  At the
*absolute* minimum, bump the version up to 5.6 so we can easily say:

	use Exporter 5.6 ( ... );

Which gives:

	C:\>perl -we "use Exporter 5.6 ( EXPORT => [qw( init )] )"
	Exporter version 5.6 required--this is only version 5.562 at -e
line 1.
	BEGIN failed--compilation aborted at -e line 1.

It'll be *much* easier to get people to type 5.6 than 5.568.

--Brent Dax <brentdax@cpan.org>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

>How do you "test" this 'God' to "prove" it is who it says it is?
"If you're God, you know exactly what it would take to convince me. Do
that."
    --Marc Fleury on alt.atheism


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