diff options
author | Sébastien Aperghis-Tramoni <sebastien@aperghis.net> | 2005-10-31 00:52:41 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-10-31 15:09:54 +0000 |
commit | 67a202d94d4ec1df620a7231c2016d22a84605c5 (patch) | |
tree | 20b4e41ea90cc5ff359ea16e1e248691eb79213d /lib/ExtUtils | |
parent | 1754c1a12c44346c579c5581660df4064b19f4a0 (diff) | |
download | perl-67a202d94d4ec1df620a7231c2016d22a84605c5.tar.gz |
Making ExtUtils::Constant compatible with Perl 5.004
Message-ID: <1130712761.43654eb9cd9f7@imp4-g19.free.fr>
with tweaks by chromatic and me.
p4raw-id: //depot/perl@25927
Diffstat (limited to 'lib/ExtUtils')
-rw-r--r-- | lib/ExtUtils/Constant.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ExtUtils/Constant.pm b/lib/ExtUtils/Constant.pm index 00f5b42e45..9e2b6b832e 100644 --- a/lib/ExtUtils/Constant.pm +++ b/lib/ExtUtils/Constant.pm @@ -1,6 +1,6 @@ package ExtUtils::Constant; use vars qw (@ISA $VERSION @EXPORT_OK %EXPORT_TAGS); -$VERSION = 0.16; +$VERSION = 0.17; =head1 NAME @@ -474,8 +474,18 @@ sub WriteConstants { croak "Module name not specified" unless length $ARGS{NAME}; - open my $c_fh, ">$ARGS{C_FILE}" or die "Can't open $ARGS{C_FILE}: $!"; - open my $xs_fh, ">$ARGS{XS_FILE}" or die "Can't open $ARGS{XS_FILE}: $!"; + my ($c_fh, $xs_fh); + if ($] <= 5.008) { + # We need these little games, rather than doing things unconditionally, + # because we're used in core Makefile.PLs before IO is available (needed + # by filehandle), but also we want to work on older perls where undefined + # scalars do not automatically turn into anonymous file handles. + require FileHandle; + $c_fh = FileHandle->new(); + $xs_fh = FileHandle->new(); + } + open $c_fh, ">$ARGS{C_FILE}" or die "Can't open $ARGS{C_FILE}: $!"; + open $xs_fh, ">$ARGS{XS_FILE}" or die "Can't open $ARGS{XS_FILE}: $!"; # As this subroutine is intended to make code that isn't edited, there's no # need for the user to specify any types that aren't found in the list of |