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

RE: [PATCH] making Exporter simpler to use

Thread Previous | Thread Next
Brent Dax
February 11, 2003 10:43
RE: [PATCH] making Exporter simpler to use
Message ID:
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 <>
@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
    --Marc Fleury on alt.atheism

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