summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ExtUtils/MM_OS2.pm4
-rw-r--r--lib/ExtUtils/MM_Unix.pm24
-rw-r--r--lib/ExtUtils/MM_VMS.pm474
-rw-r--r--lib/ExtUtils/MakeMaker.pm15
-rw-r--r--lib/ExtUtils/Mksymlists.pm6
-rw-r--r--lib/File/Copy.pm11
-rw-r--r--lib/File/Path.pm14
-rw-r--r--lib/I18N/Collate.pm2
-rw-r--r--lib/Math/BigFloat.pm127
-rw-r--r--lib/Math/BigInt.pm123
-rw-r--r--lib/Math/Complex.pm65
-rw-r--r--lib/Shell.pm49
-rw-r--r--lib/Text/ParseWords.pm128
-rw-r--r--lib/lib.pm2
14 files changed, 619 insertions, 425 deletions
diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm
index e88b899b46..1a1f8b16a0 100644
--- a/lib/ExtUtils/MM_OS2.pm
+++ b/lib/ExtUtils/MM_OS2.pm
@@ -61,6 +61,10 @@ __END__
ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
+=head1 SYNOPSIS
+
+ use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
+
=head1 DESCRIPTION
See ExtUtils::MM_Unix for a documentation of the methods provided
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
index cabb1be827..bbaef15daf 100644
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -65,7 +65,7 @@ with a directory
sub catdir {
shift;
- my $result = join('/',@_,'/');
+ my $result = join('/',@_);
$result =~ s:/\./:/:g;
$result =~ s:/+:/:g;
$result;
@@ -689,7 +689,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
my($c); ($c = $name) =~ s/\.xs$/.c/;
$xs{$name} = $c;
$c{$c} = 1;
- } elsif ($name =~ /\.c$/i){
+ } elsif ($name =~ /\.c(pp|xx|c)?$/i){ # .c .C .cpp .cxx .cc
$c{$name} = 1
unless $name =~ m/perlmain\.c/; # See MAP_TARGET
} elsif ($name =~ /\.h$/i){
@@ -772,7 +772,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
$self->{PM} = \%pm unless $self->{PM};
$self->{C} = [sort keys %c] unless $self->{C};
my(@o_files) = @{$self->{C}};
- $self->{O_FILES} = [grep s/\.c$/$self->{OBJ_EXT}/i, @o_files] ;
+ $self->{O_FILES} = [grep s/\.c(pp|xx|c)?$/$self->{OBJ_EXT}/i, @o_files] ;
$self->{H} = [sort keys %h] unless $self->{H};
$self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
@@ -1015,7 +1015,8 @@ sub const_config {
push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n");
my(%once_only);
foreach $m (@{$self->{CONFIG}}){
- next if $once_only{$m};
+ # SITE*EXP macros are defined in &constants; avoid duplicates here
+ next if $once_only{$m} or $m eq 'SITELIBEXP' or $m eq 'SITEARCHEXP';
push @m, "\U$m\E = ".$self->{uc $m}."\n";
$once_only{$m} = 1;
}
@@ -1096,7 +1097,7 @@ MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
# work around a famous dec-osf make(1) feature(?):
makemakerdflt: all
-.SUFFIXES: .xs .c .C \$(OBJ_EXT)
+.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
# some make implementations will delete the Makefile when we rebuild it. Because
@@ -1641,6 +1642,15 @@ sub c_o {
.C$(OBJ_EXT):
$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
+
+.cpp$(OBJ_EXT):
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp
+
+.cxx$(OBJ_EXT):
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx
+
+.cc$(OBJ_EXT):
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc
';
join "", @m;
}
@@ -2449,9 +2459,9 @@ sub install {
push @m, q{
install :: all pure_install doc_install
-install_perl :: pure_perl_install doc_perl_install
+install_perl :: all pure_perl_install doc_perl_install
-install_site :: pure_site_install doc_site_install
+install_site :: all pure_site_install doc_site_install
install_ :: install_site
@echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm
index 8b6625e02f..7e92a2ef06 100644
--- a/lib/ExtUtils/MM_VMS.pm
+++ b/lib/ExtUtils/MM_VMS.pm
@@ -3,11 +3,11 @@
# This package is inserted into @ISA of MakeMaker's MM before the
# built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under VMS.
#
-# Version: 5.17
# Author: Charles Bailey bailey@genetics.upenn.edu
-# Revised: 14-Jan-1996
package ExtUtils::MM_VMS;
+$ExtUtils::MM_VMS::Revision=$ExtUtils::MM_VMS::Revision = '5.21 (15-Feb-1996)';
+unshift @MM::ISA, 'ExtUtils::MM_VMS';
use Config;
require Exporter;
@@ -15,7 +15,6 @@ use VMS::Filespec;
use File::Basename;
Exporter::import('ExtUtils::MakeMaker', '$Verbose', '&neatvalue');
-unshift @MM::ISA, 'ExtUtils::MM_VMS';
sub eliminate_macros {
@@ -99,7 +98,7 @@ sub catdir {
$rslt = vmspath($self->eliminate_macros($spath)."/$sdir");
}
else { $rslt = vmspath($dir); }
- print "catdir($path,$dir) = |$rslt|\n" if $Verbose >= 3;
+ print "catdir(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
$rslt;
}
@@ -117,10 +116,13 @@ sub catfile {
my($spath) = $path;
$spath =~ s/.dir$//;
if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
- else { $rslt = vmsify($self->eliminate_macros($spath).'/'.unixify($file)); }
+ else {
+ $rslt = $self->eliminate_macros($spath);
+ $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file));
+ }
}
else { $rslt = vmsify($file); }
- print "catfile($path,$file) = |$rslt|\n" if $Verbose >= 3;
+ print "catfile(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
$rslt;
}
@@ -197,6 +199,13 @@ sub find_perl{
}
+sub path {
+ my(@dirs,$dir,$i);
+ while ($dir = $ENV{'DCL$PATH;' . $i++}) { push(@dirs,$dir); }
+ @dirs;
+}
+
+
sub maybe_command {
my($self,$file) = @_;
return $file if -x $file && ! -d _;
@@ -275,7 +284,7 @@ sub init_others {
$self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
$self->{NOECHO} ||= '@ ';
$self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
- $self->{RM_RF} = '$(PERL) -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
+ $self->{RM_RF} = '$(PERL) "-I$(PERL_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
$self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
$self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
$self->{CP} = 'Copy/NoConfirm';
@@ -284,95 +293,14 @@ sub init_others {
&ExtUtils::MM_Unix::init_others;
}
+
sub constants {
my($self) = @_;
unless (ref $self){
ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
$self = $ExtUtils::MakeMaker::Parent[-1];
}
- my(@m,$def);
- push @m, "
-NAME = $self->{NAME}
-DISTNAME = $self->{DISTNAME}
-NAME_SYM = $self->{NAME_SYM}
-VERSION = $self->{VERSION}
-VERSION_SYM = $self->{VERSION_SYM}
-VERSION_MACRO = VERSION
-DEFINE_VERSION = ",'"$(VERSION_MACRO)=""$(VERSION)"""',"
-XS_VERSION = $self->{XS_VERSION}
-XS_VERSION_MACRO = XS_VERSION
-XS_DEFINE_VERSION = ",'"$(XS_VERSION_MACRO)=""$(XS_VERSION)"""',"
-
-# In which library should we install this extension?
-# This is typically the same as PERL_LIB.
-# (also see INST_LIBDIR and relationship to ROOTEXT)
-INST_LIB = ",$self->fixpath($self->{INST_LIB},1),"
-INST_ARCHLIB = ",$self->fixpath($self->{INST_ARCHLIB},1),"
-INST_EXE = ",$self->fixpath($self->{INST_EXE},1),"
-
-PREFIX = $self->{PREFIX}
-
-# AFS users will want to set the installation directories for
-# the final 'make install' early without setting INST_LIB,
-# INST_ARCHLIB, and INST_EXE for the testing phase
-INSTALLPRIVLIB = ",$self->fixpath($self->{INSTALLPRIVLIB},1),'
-INSTALLARCHLIB = ',$self->fixpath($self->{INSTALLARCHLIB},1),'
-INSTALLBIN = ',$self->fixpath($self->{INSTALLBIN},1),'
-
-# Perl library to use when building the extension
-PERL_LIB = ',$self->fixpath($self->{PERL_LIB},1),'
-PERL_ARCHLIB = ',$self->fixpath($self->{PERL_ARCHLIB},1),'
-LIBPERL_A = ',$self->fixpath($self->{LIBPERL_A}),'
-
-MAKEMAKER = ',$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),"
-MM_VERSION = $ExtUtils::MakeMaker::VERSION
-FIRST_MAKEFILE = ",$self->fixpath($self->{FIRST_MAKEFILE}),'
-MAKE_APERL_FILE = ',$self->fixpath($self->{MAKE_APERL_FILE}),"
-
-PERLMAINCC = $self->{PERLMAINCC}
-";
-
- if ($self->{PERL_SRC}) {
- push @m, "
-# Where is the perl source code located?
-PERL_SRC = ",$self->fixpath($self->{PERL_SRC},1);
- push @m, "
-PERL_VMS = ",$self->catdir($self->{PERL_SRC},q(VMS));
- }
- push @m,"
-# Perl header files (will eventually be under PERL_LIB)
-PERL_INC = ",$self->fixpath($self->{PERL_INC},1),"
-# Perl binaries
-PERL = $self->{PERL}
-FULLPERL = $self->{FULLPERL}
-
-# FULLEXT = Pathname for extension directory (eg DBD/Oracle).
-# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
-# ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD)
-FULLEXT = ",$self->fixpath($self->{FULLEXT},1),"
-BASEEXT = $self->{BASEEXT}
-ROOTEXT = ",($self->{ROOTEXT} eq '') ? '[]' : $self->fixpath($self->{ROOTEXT},1),"
-DLBASE = $self->{DLBASE}
-";
-
- push @m, "
-VERSION_FROM = $self->{VERSION_FROM}
-" if defined $self->{VERSION_FROM};
-
- push @m,'
-INC = ';
-
- if ($self->{'INC'}) {
- push @m,'/Include=(';
- my(@includes) = split(/\s+/,$self->{INC});
- my($plural);
- foreach (@includes) {
- s/^-I//;
- push @m,', ' if $plural++;
- push @m,$self->fixpath($_,1);
- }
- push @m, ")\n";
- }
+ my(@m,$def,$macro);
if ($self->{DEFINE} ne '') {
my(@defs) = split(/\s+/,$self->{DEFINE});
@@ -390,35 +318,99 @@ INC = ';
}
$self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
- push @m,"
-DEFINE = $self->{DEFINE}
-OBJECT = $self->{OBJECT}
-LDFROM = $self->{LDFROM}
-LINKTYPE = $self->{LINKTYPE}
+ if ($self->{'INC'} && $self->{INC} !~ m!/Include=!i) {
+ my(@val) = ( '/Include=(' );
+ my(@includes) = split(/\s+/,$self->{INC});
+ my($plural);
+ foreach (@includes) {
+ s/^-I//;
+ push @val,', ' if $plural++;
+ push @val,$self->fixpath($_,1);
+ }
+ $self->{INC} = join('',@val,')');
+ }
+
+ # Fix up directory specs
+ $self->{ROOTEXT} = $self->{ROOTEXT} ? $self->fixpath($self->{ROOTEXT},1)
+ : '[]';
+ foreach $macro ( qw [
+ INST_LIB INST_ARCHLIB INST_EXE INSTALLPRIVLIB INSTALLARCHLIB
+ INSTALLBIN PERL_LIB PERL_ARCHLIB PERL_INC PERL_SRC FULLEXT
+ INST_MAN1DIR INSTALLMAN1DIR INST_MAN3DIR INSTALLMAN3DIR
+ INSTALLSITELIB INSTALLSITEARCH SITELIBEXP SITEARCHEXP ] ) {
+ next unless defined $self->{$macro};
+ $self->{$macro} = $self->fixpath($self->{$macro},1);
+ }
+ $self->{PERL_VMS} = $self->catdir($self->{PERL_SRC},q(VMS))
+ if ($self->{PERL_SRC});
+
+
+
+ # Fix up file specs
+ foreach $macro ( qw[LIBPERL_A FIRST_MAKEFILE MAKE_APERL_FILE MYEXTLIB] ) {
+ next unless defined $self->{$macro};
+ $self->{$macro} = $self->fixpath($self->{$macro});
+ }
+
+ for $tmp (qw/
+ AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION
+ INST_LIB INST_ARCHLIB INST_EXE PREFIX INSTALLDIRS INSTALLPRIVLIB
+ INSTALLARCHLIB INSTALLSITELIB INSTALLSITEARCH INSTALLBIN PERL_LIB
+ PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
+ FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_VMS
+ PERL_INC PERL FULLPERL
+ / ) {
+ next unless defined $self->{$tmp};
+ push @m, "$tmp = $self->{$tmp}\n";
+ }
+
+
+ push @m, q[
+VERSION_MACRO = VERSION
+DEFINE_VERSION = "$(VERSION_MACRO)=""$(VERSION)"""
+XS_VERSION_MACRO = XS_VERSION
+XS_DEFINE_VERSION = "$(XS_VERSION_MACRO)=""$(XS_VERSION)"""
+
+MAKEMAKER = ],$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),qq[
+MM_VERSION = $ExtUtils::MakeMaker::VERSION
+MM_REVISION = $ExtUtils::MakeMaker::Revision
+MM_VMS_REVISION = $ExtUtils::MM_VMS::Revision
+
+# FULLEXT = Pathname for extension directory (eg DBD/Oracle).
+# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
+# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
+# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
+];
+
+ for $tmp (qw/
+ FULLEXT BASEEXT ROOTEXT DLBASE VERSION_FROM INC DEFINE OBJECT
+ LDFROM LINKTYPE
+ / ) {
+ next unless defined $self->{$tmp};
+ push @m, "$tmp = $self->{$tmp}\n";
+ }
+
+ push @m,'
# Handy lists of source code files:
-XS_FILES = ",join(', ', sort keys %{$self->{XS}}),'
+XS_FILES = ',join(', ', sort keys %{$self->{XS}}),'
C_FILES = ',join(', ', @{$self->{C}}),'
O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
H_FILES = ',join(', ', @{$self->{H}}),'
-MAN1PODS = ',join(" \\\n\t", sort keys %{$self->{MAN1PODS}}),'
-MAN3PODS = ',join(" \\\n\t", sort keys %{$self->{MAN3PODS}}),'
-
-# Man installation stuff:
-INST_MAN1DIR = ',$self->fixpath($self->{INST_MAN1DIR},1),'
-INSTALLMAN1DIR = ',$self->fixpath($self->{INSTALLMAN1DIR},1),"
-MAN1EXT = $self->{MAN1EXT}
-
-INST_MAN3DIR = ",$self->fixpath($self->{INST_MAN3DIR},1),'
-INSTALLMAN3DIR = ',$self->fixpath($self->{INSTALLMAN3DIR},1),"
-MAN3EXT = $self->{MAN3EXT}
+MAN1PODS = ',join(', ', sort keys %{$self->{MAN1PODS}}),'
+MAN3PODS = ',join(', ', sort keys %{$self->{MAN3PODS}}),'
+';
-.SUFFIXES : .xs .c \$(OBJ_EXT)
+ for $tmp (qw/
+ INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
+ /) {
+ next unless defined $self->{$tmp};
+ push @m, "$tmp = $self->{$tmp}\n";
+ }
-# This extension may link to it's own library (see SDBM_File)";
- push @m,"
-MYEXTLIB = ",$self->fixpath($self->{MYEXTLIB}),"
+push @m,"
+.SUFFIXES : .xs .c .cpp .cxx \$(OBJ_EXT)
# Here is the Config.pm that we are using/depend on
CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h \$(VERSION_FROM)
@@ -696,7 +688,7 @@ sub tools_other {
ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
$self = $ExtUtils::MakeMaker::Parent[-1];
}
- "
+ qq!
# Assumes \$(MMS) invokes MMS or MMK
# (It is assumed in some cases later that the default makefile name
# (Descrip.MMS for MM[SK]) is used.)
@@ -713,7 +705,12 @@ RM_F = $self->{RM_F}
RM_RF = $self->{RM_RF}
UMASK_NULL = $self->{UMASK_NULL}
MKPATH = Create/Directory
-";
+EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,qq{>\$ARGV[1]};close F;utime(0,(stat(\$ARGV[0]))[9]+1,\$ARGV[1])"
+WARN_IF_OLD_PACKLIST = \$(PERL) -e "if (-f \$ARGV[0]){print qq[WARNING: Old package found (\$ARGV[0]); please check for collisions\\n]}"
+MOD_INSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "install({split(' ',<STDIN>)},1);"
+DOC_INSTALL = \$(PERL) -e "@ARGV=split('|',<STDIN>);print '=head3 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];while(\$key=shift && \$val=shift){print qq[=item *\\n\\nC<\$key: \$val>\\n\\n];}print qq[=back\\n\\n]"
+UNINSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "uninstall(\$ARGV[0],1);"
+!;
}
@@ -808,7 +805,7 @@ sub top_targets {
}
my(@m);
push @m, '
-all :: config $(INST_PM) subdirs linkext manifypods reorg_packlist
+all :: config $(INST_PM) subdirs linkext manifypods
$(NOOP)
subdirs :: $(MYEXTLIB)
@@ -817,13 +814,18 @@ subdirs :: $(MYEXTLIB)
config :: $(MAKEFILE) $(INST_LIBDIR).exists
$(NOOP)
-config :: $(INST_ARCHAUTODIR).exists Version_check
+config :: $(INST_ARCHAUTODIR).exists
$(NOOP)
config :: $(INST_AUTODIR).exists
$(NOOP)
';
+ push @m, q{
+config :: Version_check
+
+} unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl");
+
push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
if (%{$self->{MAN1PODS}}) {
@@ -853,8 +855,7 @@ help :
push @m, q{
Version_check :
},$self->{NOECHO},q{$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
- -e "use ExtUtils::MakeMaker qw($Version &Version_check);" -
- -e "&Version_check('$(MM_VERSION)')"
+ "-MExtUtils::MakeMaker=Version_check" -e "&Version_check('$(MM_VERSION)')"
};
join('',@m);
@@ -871,17 +872,30 @@ sub dlsyms {
return '' unless $self->needs_linking();
my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
+ my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
+ my($srcdir)= $attribs{PERL_SRC} || $self->{PERL_SRC} || '';
my(@m);
- push(@m,'
+ unless ($self->{SKIPHASH}{'dynamic'}) {
+ push(@m,'
dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
$(NOOP)
-
+');
+ if ($srcdir) {
+ my($opt) = $self->catfile($srcdir,'perlshr.opt');
+ push(@m,"# Depend on $(BASEEXT).opt to insure we copy here *after* autogenerating (wrong) rtls.opt in Mksymlists
+rtls.opt : $opt \$(BASEEXT).opt
+ Copy/Log $opt Sys\$Disk:[]rtls.opt
+");
+ }
+ else {
+ push(@m,'
# rtls.opt is built in the same step as $(BASEEXT).opt
rtls.opt : $(BASEEXT).opt
$(TOUCH) $(MMS$TARGET)
-') unless $self->{SKIPHASH}{'dynamic'};
+');
+ }
+ }
push(@m,'
static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
@@ -891,7 +905,6 @@ static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
push(@m,'
$(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
$(CP) $(MMS$SOURCE) $(MMS$TARGET)
- ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
$(BASEEXT).opt : Makefile.PL
$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" -
@@ -929,7 +942,6 @@ INST_DYNAMIC_DEP = $inst_dynamic_dep
$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
',$self->{NOECHO},'$(MKPATH) $(INST_ARCHAUTODIR)
Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
- ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
';
push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
@@ -956,12 +968,10 @@ $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
'.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
-e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
'.$self->{NOECHO}.' $(TOUCH) $(MMS$TARGET)
- '.$self->{NOECHO}.'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
'.$self->{NOECHO}.'$(RM_RF) $(INST_BOOT)
- $(CP) $(BOOTSTRAP) $(INST_BOOT)
- '.$self->{NOECHO}.'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
';
}
# --- Static Loading Sections ---
@@ -994,7 +1004,6 @@ $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
- ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
');
push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('',@m);
@@ -1021,7 +1030,6 @@ $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
",' ',$self->{NOECHO},'$(RM_F) $(MMS$TARGET)
',$self->{NOECHO},'$(CP) ',"$dist $inst",'
$(CHMOD) 644 $(MMS$TARGET)
- ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
');
push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
$self->catdir($splitlib,'auto')."\n\n")
@@ -1155,25 +1163,6 @@ $to : $from \$(MAKEFILE) ${todir}.exists
# --- Sub-directory Sections ---
-sub pasthru {
- my($self) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$key);
- my(@pasthru);
-
- foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
- INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A LINKTYPE)){
- push @pasthru, "$key=\"$self->{$key}\"";
- }
-
- push @m, "\nPASTHRU = \\\n ", join (",\\\n ", @pasthru), "\n";
- join "", @m;
-}
-
-
sub subdir_x {
my($self, $subdir) = @_;
unless (ref $self){
@@ -1390,82 +1379,100 @@ sub install {
ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
$self = $ExtUtils::MakeMaker::Parent[-1];
}
- my(@m);
- push @m, q{
-doc_install ::
- },$self->{NOECHO},q{Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
- },$self->{NOECHO},q{$(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\
- -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
- 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', 'XS_VERSION=$(XS_VERSION)', 'EXE_FILES=$(EXE_FILES)')" \\
- >>$(INSTALLARCHLIB)perllocal.pod
-};
+ my(@m,@docfiles);
- push(@m, "
-install :: pure_install doc_install
- \$(NOOP)
-
-# Interim solution for VMS; assumes directory tree of same structure under
-# both \$(INST_LIB) and \$(INSTALLPRIVLIB). This operation will be assumed
-# into MakeMaker in a (near) future version.
-pure_install :: all
-");
-# # install subdirectories first
-# foreach(@{$self->{DIR}}){
-# my($vmsdir) = $self->fixpath($_,1);
-# push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
-# '; print `$(MMS) install`"'."\n");
-# }
-#
-# push(@m, ' ',$self->{NOECHO},'$(PERL) "-I$(PERL_LIB)" -e "use File::Path; mkpath(\@ARGV)" $(INSTALLPRIVLIB) $(INSTALLARCHLIB)
-# ',$self->{NOECHO},'$(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLPRIVLIB)
-# ',$self->{NOECHO},'$(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLARCHLIB)',"
-# # Can't install manpages here -- INST_MAN%DIR macros make line >255 chars
-# \$(MMS) \$(USEMACROS)INST_LIB=$self->{INSTALLPRIVLIB},INST_ARCHLIB=$self->{INSTALLARCHLIB},INST_EXE=$self->{INSTALLBIN}\$(MACROEND)",'
-# ',$self->{NOECHO},'$(PERL) -i_bak -lne "print unless $seen{$_}++" $(INST_ARCHAUTODIR).packlist
-#');
-
- my($curtop,$insttop);
- ($curtop = $self->fixpath($self->{INST_LIB},1)) =~ s/]$//;
- ($insttop = $self->fixpath($self->{INSTALLPRIVLIB},1)) =~ s/]$//;
- push(@m," Backup/Log ${curtop}...]*.*; ${insttop}...]/New_Version/By_Owner=Parent\n");
-
- my($oldpacklist) = $self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist');
- push @m,'
-# This song and dance brought to you by DCL\'s 255 char limit
-reorg_packlist :
-';
- my($oldpacklist) = $self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist');
- if ("\L$oldpacklist" ne "\L$self->{INST_ARCHAUTODIR}.packlist") {
- push(@m,' If F$Search("',$oldpacklist,'").nes."" Then Append/New ',$oldpacklist,' $(INST_ARCHAUTODIR).packlist');
+ if ($self->{EXE_FILES}) {
+ my($line,$file) = ('','');
+ foreach $file (@{$self->{EXE_FILES}}) {
+ $line .= "$file ";
+ if (length($line) > 128) {
+ push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]);
+ $line = '';
+ }
+ }
+ push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]) if $line;
}
- push @m,'
- $(PERL) -ne "BEGIN{exit unless -e $ARGV[0];}print unless $s{$_}++;" $(INST_ARCHAUTODIR).packlist >.MM_tmp
- If F$Search(".MM_tmp").nes."" Then Copy/NoConfirm .MM_tmp $(INST_ARCHAUTODIR).packlist
- If F$Search(".MM_tmp").nes."" Then Delete/NoConfirm .MM_tmp;
-';
-
-# From MM 5.16:
push @m, q[
-# Comment on .packlist rewrite above:
-# Read both .packlist files: the old one in PERL_ARCHLIB/auto/FULLEXT, and the new one
-# in INSTARCHAUTODIR. Don't croak if they are missing. Write to the one
-# in INSTARCHAUTODIR.
+install :: all pure_install doc_install
+ $(NOOP)
+
+install_perl :: all pure_perl_install doc_perl_install
+ $(NOOP)
+
+install_site :: all pure_site_install doc_site_install
+ $(NOOP)
+
+install_ :: install_site
+ ],$self->{NOECHO},q[Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
+
+pure_install :: pure_$(INSTALLDIRS)_install
+ $(NOOP)
+
+doc_install :: doc_$(INSTALLDIRS)_install
+ ],$self->{NOECHO},q[Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
+
+pure__install : pure_site_install
+ ],$self->{NOECHO},q[Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
+
+doc__install : doc_site_install
+ ],$self->{NOECHO},q[Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
+
+# This hack brought to you by DCL's 255-character command line limit
+pure_perl_install ::
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'read ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'write ].$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_LIB) $(INSTALLPRIVLIB) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLARCHLIB) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_EXE) $(INSTALLBIN) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
+ $(MOD_INSTALL) <.MM_tmp
+ ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
+ ].$self->{NOECHO}.q[$(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[
+
+# Likewise
+pure_site_install ::
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'read ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'write ].$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_LIB) $(INSTALLSITELIB) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLSITEARCH) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_EXE) $(INSTALLBIN) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
+ $(MOD_INSTALL) <.MM_tmp
+ ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
+ ].$self->{NOECHO}.q[$(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
+
+# Ditto
+doc_perl_install ::
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLPRIVLIB)|'" >.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
+],@docfiles,q[ $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
+ ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
+
+# And again
+doc_site_install ::
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLSITELIB)|'" >.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
+],@docfiles,q[ $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
+ ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
+
];
- push @m, '
-##### UNINSTALL IS STILL EXPERIMENTAL ####
-uninstall ::
-';
- foreach(@{$self->{DIR}}){
- my($vmsdir) = $self->fixpath($_,1);
- push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
- '; print `$(MMS) uninstall`"'."\n");
- }
- push @m, "\t".'$(PERL) -le "use File::Path; foreach (<>) {s/',"$curtop/$insttop/;",'rmtree($_,1,0);}" <$(INST_ARCHAUTODIR).packlist
-';
+ push @m, q[
+uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOOP)
+
+uninstall_from_perldirs ::
+ ].$self->{NOECHO}.q[$(UNINSTALL) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
+
+uninstall_from_sitedirs ::
+ ].$self->{NOECHO}.q[$(UNINSTALL) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist')."\n";
- join("",@m);
+ join('',@m);
}
@@ -1533,7 +1540,7 @@ $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
',$self->{NOECHO},'Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
- $(MV) $(MAKEFILE) $(MAKEFILE)_old
- $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
- $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ',join(' ',@ARGV),'
+ $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ',join(' ',map(qq["$_"],@ARGV)),'
',$self->{NOECHO},'Write Sys$Output "$(MAKEFILE) has been rebuilt."
',$self->{NOECHO},'Write Sys$Output "Please run $(MMS) to build the extension."
';
@@ -1562,13 +1569,14 @@ test : \$(TEST_TYPE)
push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
'; print `$(MMS) $(PASTHRU2) test`'."\n");
}
- push(@m, "\t$self->{NOECHO}Write Sys\$Output 'No tests defined for \$(NAME) extension.'\n")
+ push(@m, "\t$self->{NOECHO}Write Sys\$Output \"No tests defined for \$(NAME) extension.\"\n")
unless $tests or -f "test.pl" or @{$self->{DIR}};
push(@m, "\n");
push(@m, "test_dynamic :: all\n");
push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
+ push(@m, " \$(NOOP)\n") if (!$tests && ! -f "test.pl");
push(@m, "\n");
# Occasionally we may face this degenerate target:
@@ -1578,10 +1586,11 @@ test : \$(TEST_TYPE)
push(@m, "test_static :: all \$(MAP_TARGET)\n");
push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
+ push(@m, "\t$self->{NOECHO}\$(NOOP)\n") if (!$tests && ! -f "test.pl");
push(@m, "\n");
}
else {
- push @m, "test_static :: test_dynamic\n";
+ push @m, "test_static :: test_dynamic\n\t$self->{NOECHO}\$(NOOP)\n";
}
join('',@m);
@@ -1605,7 +1614,7 @@ sub test_via_script {
ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
$self = $ExtUtils::MakeMaker::Parent[-1];
}
- " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" test.pl
+ " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '.$script.'
';
}
@@ -1757,10 +1766,16 @@ $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt"
',$self->{NOECHO},'$(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
';
- push @m, q{
+ push @m, q[
+# More from the 255-char line length limit
doc_inst_perl :
- },$self->{NOECHO},q{$(PERL) -e "use ExtUtils::MakeMaker; MY->new()->writedoc('Perl binary','$(MAP_TARGET)','MAP_STATIC=$(MAP_STATIC)','MAP_EXTRA=$(MAP_EXTRA)','MAP_LIBPERL=$(MAP_LIBPERL)')"
-};
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'Perl binary $(MAP_TARGET)|'" >.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'MAP_STATIC|$(MAP_STATIC)|'" >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp
+ ].$self->{NOECHO}.q[$(PERL) -e "print 'MAP_LIBPERL|$(MAP_LIBPERL)|'" >>.MM_tmp
+ $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
+ ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
+];
push @m, "
inst_perl : pure_inst_perl doc_inst_perl
@@ -1781,7 +1796,7 @@ map_clean :
join '', @m;
}
-sub extliblist {
+sub ext {
my($self) = @_;
unless (ref $self){
ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
@@ -1795,9 +1810,9 @@ sub extliblist {
# dir_target(@array) returns a Makefile entry for the file .exists in each
# named directory. Returns nothing, if the entry has already been processed.
# We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
-# Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
-# prerequisite, because there has to be one, something that doesn't change
-# too often :)
+# Both of them get an entry, that's why we use "::". I chose
+# '$(PERL_INC)perl.h' as the prerequisite, because there has to be one,
+# something that doesn't change too often :)
sub dir_target {
my($self,@dirs) = @_;
@@ -1812,7 +1827,7 @@ sub dir_target {
push @m, "
${vmsdir}.exists :: \$(PERL_INC)perl.h
$self->{NOECHO}\$(MKPATH) $vmsdir
- $self->{NOECHO}\$(TOUCH) ${vmsdir}.exists
+ $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) \$(MMS\$SOURCE) \$(MMS\$TARGET)
";
}
join "", @m;
@@ -1844,9 +1859,12 @@ __END__
ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker
+=head1 SYNOPSIS
+
+ use ExtUtils::MM_VMS; # Done internally by ExtUtils::MakeMaker if needed
+
=head1 DESCRIPTION
See ExtUtils::MM_Unix for a documentation of the methods provided
there. This package overrides the implementation of these methods, not
the semantics.
-
diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm
index 76486b1c4c..f2ee0ce797 100644
--- a/lib/ExtUtils/MakeMaker.pm
+++ b/lib/ExtUtils/MakeMaker.pm
@@ -160,15 +160,20 @@ eval {require DynaLoader;}; # Get mod2fname, if defined. Will fail
}
#
-# No we can can pull in the friends
+# Now we can can pull in the friends
+# Since they will require us back, we would better prepare the needed
+# data _before_ we require them.
#
+$Is_VMS = ($Config{osname} eq 'VMS');
+$Is_OS2 = ($Config{osname} =~ m|^os/?2$|i);
+
require ExtUtils::MM_Unix;
-if ($Is_VMS = ($Config{osname} eq 'VMS')) {
+if ($Is_VMS) {
require ExtUtils::MM_VMS;
require VMS::Filespec;
import VMS::Filespec '&vmsify';
}
-if ($Is_OS2 = $Config{osname} =~ m|^os/?2$|i) {
+if ($Is_OS2) {
require ExtUtils::MM_OS2;
}
@@ -568,7 +573,7 @@ sub parse_args{
$value = $self->catdir("..",$value)
if $Prepend_dot_dot{$name} && ! $value =~ m!^/!;
}
- $self->{$name} = $value;
+ $self->{uc($name)} = $value;
}
# This may go away, in mid 1996
delete $self->{Correct_relativ_directories};
@@ -1758,7 +1763,7 @@ An example:
Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas
KE<ouml>nig F<E<lt>A.Koenig@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce
F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey
-F<E<lt>bailey@HMIVAX.HUMGEN.UPENN.EDUE<gt>>. OS/2 support by Ilya
+F<E<lt>bailey@genetics.upenn.eduE<gt>>. OS/2 support by Ilya
Zakharevich F<E<lt>ilya@math.ohio-state.eduE<gt>>. Contact the
makemaker mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if
you have any questions.
diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm
index aa21f4388d..1d7ae8c669 100644
--- a/lib/ExtUtils/Mksymlists.pm
+++ b/lib/ExtUtils/Mksymlists.pm
@@ -169,8 +169,8 @@ from which it is usually taken. Its value is a reference to an
associative array, in which each key is the name of a package, and
each value is an a reference to an array of function names which
should be exported by the extension. For instance, one might say
-C<DL_FUNCS => { Homer::Iliad => [ qw(trojans greeks) ],
-Homer::Odyssey => [ qw(travellers family suitors) ] }>. The
+C<DL_FUNCS =E<gt> { Homer::Iliad =E<gt> [ qw(trojans greeks) ],
+Homer::Odyssey =E<gt> [ qw(travellers family suitors) ] }>. The
function names should be identical to those in the XSUB code;
C<Mksymlists> will alter the names written to the linker option
file to match the changes made by F<xsubpp>. In addition, if
@@ -221,4 +221,4 @@ Charles Bailey I<E<lt>bailey@genetics.upenn.eduE<gt>>
=head1 REVISION
-Last revised 14-Jan-1996, for Perl 5.002.
+Last revised 14-Feb-1996, for Perl 5.002.
diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm
index b4a075dbe1..62697456b7 100644
--- a/lib/File/Copy.pm
+++ b/lib/File/Copy.pm
@@ -24,6 +24,10 @@ sub copy {
croak("Usage: copy( file1, file2 [, buffersize]) ")
unless(@_ == 2 || @_ == 3);
+ # VMS: perform RMS copy to preserve file attributes, indices, etc.
+ # This function is always defined under VMS, even in miniperl
+ if (defined(&File::Copy::rmscopy)) { return File::Copy::rmscopy($_[0],$_[1]) }
+
my $from = shift;
my $to = shift;
my $recsep = $\;
@@ -99,11 +103,12 @@ sub copy {
1;
__END__
+
=head1 NAME
File::Copy - Copy files or filehandles
-=head1 USAGE
+=head1 SYNOPSIS
use File::Copy;
@@ -133,6 +138,10 @@ being written to the second file. The default buffer size depends
upon the file, but will generally be the whole file (up to 2Mb), or
1k for filehandles that do not reference files (eg. sockets).
+When running under VMS, this routine performs an RMS copy of
+the file, in order to preserve file attributed, indexed file
+structure, I<etc.> The buffer size parameter is ignored.
+
You may use the syntax C<use File::Copy "cp"> to get at the
"cp" alias for this function. The syntax is I<exactly> the same.
diff --git a/lib/File/Path.pm b/lib/File/Path.pm
index 6cb675b683..8a17173b0d 100644
--- a/lib/File/Path.pm
+++ b/lib/File/Path.pm
@@ -73,7 +73,8 @@ than VMS is settled. (defaults to FALSE)
=back
-It returns the number of files successfully deleted.
+It returns the number of files successfully deleted. Symlinks are
+treated as ordinary files.
=head1 AUTHORS
@@ -82,10 +83,13 @@ Charles Bailey <bailey@genetics.upenn.edu>
=head1 REVISION
-This document was last revised 25-Aug-1995, for perl 5.002
+This module was last revised 14-Feb-1996, for perl 5.002. $VERSION is
+1.01.
=cut
+$VERSION = "1.01"; # That's my hobby-horse, A.K.
+
require 5.000;
use Config;
use Carp;
@@ -95,7 +99,7 @@ require Exporter;
$Is_VMS = $Config{'osname'} eq 'VMS';
-sub mkpath{
+sub mkpath {
my($paths, $verbose, $mode) = @_;
# $paths -- either a path string or ref to list of paths
# $verbose -- optional print "mkdir $path" for each directory created
@@ -126,7 +130,7 @@ sub rmtree {
foreach $root (@{$roots}) {
$root =~ s#/$##;
- if (-d $root) {
+ if (not -l $root and -d _) {
opendir(D,$root);
($root = VMS::Filespec::unixify($root)) =~ s#\.dir$## if $Is_VMS;
@files = map("$root/$_", grep $_!~/^\.{1,2}$/, readdir(D));
@@ -147,7 +151,7 @@ sub rmtree {
next;
}
print "unlink $root\n" if $verbose;
- while (-e $root) { # delete all versions under VMS
+ while (-e $root || -l $root) { # delete all versions under VMS
(unlink($root) && ++$count)
or carp "Can't unlink file $root: $!";
}
diff --git a/lib/I18N/Collate.pm b/lib/I18N/Collate.pm
index d012fcc5ce..0d8314e12e 100644
--- a/lib/I18N/Collate.pm
+++ b/lib/I18N/Collate.pm
@@ -99,7 +99,7 @@ require Exporter;
@EXPORT = qw(collate_xfrm setlocale LC_COLLATE);
@EXPORT_OK = qw();
-%OVERLOAD = qw(
+use overload qw(
fallback 1
cmp collate_cmp
);
diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm
index 92e701666f..7551ad01a3 100644
--- a/lib/Math/BigFloat.pm
+++ b/lib/Math/BigFloat.pm
@@ -5,31 +5,31 @@ use Math::BigInt;
use Exporter; # just for use to be happy
@ISA = (Exporter);
-%OVERLOAD = (
- # Anonymous subroutines:
-'+' => sub {new BigFloat &fadd},
-'-' => sub {new BigFloat
+use overload
+'+' => sub {new Math::BigFloat &fadd},
+'-' => sub {new Math::BigFloat
$_[2]? fsub($_[1],${$_[0]}) : fsub(${$_[0]},$_[1])},
-'<=>' => sub {new BigFloat
+'<=>' => sub {new Math::BigFloat
$_[2]? fcmp($_[1],${$_[0]}) : fcmp(${$_[0]},$_[1])},
-'cmp' => sub {new BigFloat
+'cmp' => sub {new Math::BigFloat
$_[2]? ($_[1] cmp ${$_[0]}) : (${$_[0]} cmp $_[1])},
-'*' => sub {new BigFloat &fmul},
-'/' => sub {new BigFloat
+'*' => sub {new Math::BigFloat &fmul},
+'/' => sub {new Math::BigFloat
$_[2]? scalar fdiv($_[1],${$_[0]}) :
scalar fdiv(${$_[0]},$_[1])},
-'neg' => sub {new BigFloat &fneg},
-'abs' => sub {new BigFloat &fabs},
+'neg' => sub {new Math::BigFloat &fneg},
+'abs' => sub {new Math::BigFloat &fabs},
qw(
"" stringify
0+ numify) # Order of arguments unsignificant
-);
+;
sub new {
- my $foo = fnorm($_[1]);
- panic("Not a number initialized to BigFloat") if $foo eq "NaN";
- bless \$foo;
+ my ($class) = shift;
+ my ($foo) = fnorm(shift);
+ panic("Not a number initialized to Math::BigFloat") if $foo eq "NaN";
+ bless \$foo, $class;
}
sub numify { 0 + "${$_[0]}" } # Not needed, additional overhead
# comparing to direct compilation based on
@@ -58,21 +58,6 @@ sub stringify {
return $n;
}
-# Arbitrary length float math package
-#
-# by Mark Biggar
-#
-# number format
-# canonical strings have the form /[+-]\d+E[+-]\d+/
-# Input values can have inbedded whitespace
-# Error returns
-# 'NaN' An input parameter was "Not a Number" or
-# divide by zero or sqrt of negative number
-# Division is computed to
-# max($div_scale,length(dividend)+length(divisor))
-# digits by default.
-# Also used for default sqrt scale
-
$div_scale = 40;
# Rounding modes one of 'even', 'odd', '+inf', '-inf', 'zero' or 'trunc'.
@@ -84,21 +69,6 @@ sub fneg; sub fabs; sub fcmp;
sub fround; sub ffround;
sub fnorm; sub fsqrt;
-# bigfloat routines
-#
-# fadd(NSTR, NSTR) return NSTR addition
-# fsub(NSTR, NSTR) return NSTR subtraction
-# fmul(NSTR, NSTR) return NSTR multiplication
-# fdiv(NSTR, NSTR[,SCALE]) returns NSTR division to SCALE places
-# fneg(NSTR) return NSTR negation
-# fabs(NSTR) return NSTR absolute value
-# fcmp(NSTR,NSTR) return CODE compare undef,<0,=0,>0
-# fround(NSTR, SCALE) return NSTR round to SCALE digits
-# ffround(NSTR, SCALE) return NSTR round at SCALEth place
-# fnorm(NSTR) return (NSTR) normalize
-# fsqrt(NSTR[, SCALE]) return NSTR sqrt to SCALE places
-
-
# Convert a number to canonical string form.
# Takes something that looks like a number and converts it to
# the form /^[+-]\d+E[+-]\d+$/.
@@ -154,7 +124,7 @@ sub fmul { #(fnum_str, fnum_str) return fnum_str
&norm(Math::BigInt::bmul($xm,$ym),$xe+$ye);
}
}
-
+
# addition
sub fadd { #(fnum_str, fnum_str) return fnum_str
local($x,$y) = (fnorm($_[$[]),fnorm($_[$[+1]));
@@ -192,7 +162,7 @@ sub fdiv #(fnum_str, fnum_str[,scale]) return fnum_str
$xe-$ye-$scale);
}
}
-
+
# round int $q based on fraction $r/$base using $rnd_mode
sub round { #(int_str, int_str, int_str) return int_str
local($q,$r,$base) = @_;
@@ -233,7 +203,7 @@ sub fround { #(fnum_str, scale) return fnum_str
}
}
}
-
+
# round $x at the 10 to the $scale digit place
sub ffround { #(fnum_str, scale) return fnum_str
local($x,$scale) = (fnorm($_[$[]),$_[$[+1]);
@@ -273,7 +243,7 @@ sub fcmp #(fnum_str, fnum_str) return cond_code
);
}
}
-
+
# square root by Newtons method.
sub fsqrt { #(fnum_str[, scale]) return fnum_str
local($x, $scale) = (fnorm($_[$[]), $_[$[+1]);
@@ -290,8 +260,67 @@ sub fsqrt { #(fnum_str[, scale]) return fnum_str
$guess = fmul(fadd($guess,fdiv($x,$guess,$gs*2)),".5");
$gs *= 2;
}
- new BigFloat &fround($guess, $scale);
+ new Math::BigFloat &fround($guess, $scale);
}
}
1;
+__END__
+
+=head1 NAME
+
+Math::BigFloat - Arbitrary length float math package
+
+=head1 SYNOPSIS
+
+ use Math::BogFloat;
+ $f = Math::BigFloat->new($string);
+
+ $f->fadd(NSTR) return NSTR addition
+ $f->fsub(NSTR) return NSTR subtraction
+ $f->fmul(NSTR) return NSTR multiplication
+ $f->fdiv(NSTR[,SCALE]) returns NSTR division to SCALE places
+ $f->fneg() return NSTR negation
+ $f->fabs() return NSTR absolute value
+ $f->fcmp(NSTR) return CODE compare undef,<0,=0,>0
+ $f->fround(SCALE) return NSTR round to SCALE digits
+ $f->ffround(SCALE) return NSTR round at SCALEth place
+ $f->fnorm() return (NSTR) normalize
+ $f->fsqrt([SCALE]) return NSTR sqrt to SCALE places
+
+=head1 DESCRIPTION
+
+All basic math operations are overloaded if you declare your big
+floats as
+
+ $float = new Math::BigFloat "2.123123123123123123123123123123123";
+
+=over 2
+
+=item number format
+
+canonical strings have the form /[+-]\d+E[+-]\d+/ . Input values can
+have inbedded whitespace.
+
+=item Error returns 'NaN'
+
+An input parameter was "Not a Number" or divide by zero or sqrt of
+negative number.
+
+=item Division is computed to
+
+C<max($div_scale,length(dividend)+length(divisor))> digits by default.
+Also used for default sqrt scale.
+
+=back
+
+=head1 BUGS
+
+The current version of this module is a preliminary version of the
+real thing that is currently (as of perl5.002) under development.
+
+=head1 AUTHOR
+
+Mark Biggar
+
+=cut
diff --git a/lib/Math/BigInt.pm b/lib/Math/BigInt.pm
index 8c0ca4e6d4..68856aea6e 100644
--- a/lib/Math/BigInt.pm
+++ b/lib/Math/BigInt.pm
@@ -1,7 +1,6 @@
package Math::BigInt;
-%OVERLOAD = (
- # Anonymous subroutines:
+use overload
'+' => sub {new Math::BigInt &badd},
'-' => sub {new Math::BigInt
$_[2]? bsub($_[1],${$_[0]}) : bsub(${$_[0]},$_[1])},
@@ -23,57 +22,24 @@ package Math::BigInt;
qw(
"" stringify
0+ numify) # Order of arguments unsignificant
-);
+;
$NaNOK=1;
sub new {
- my $foo = bnorm($_[1]);
+ my($class) = shift;
+ my($foo) = bnorm(shift);
die "Not a number initialized to Math::BigInt" if !$NaNOK && $foo eq "NaN";
- bless \$foo;
+ bless \$foo, $class;
}
sub stringify { "${$_[0]}" }
sub numify { 0 + "${$_[0]}" } # Not needed, additional overhead
# comparing to direct compilation based on
# stringify
-# arbitrary size integer math package
-#
-# by Mark Biggar
-#
-# Canonical Big integer value are strings of the form
-# /^[+-]\d+$/ with leading zeros suppressed
-# Input values to these routines may be strings of the form
-# /^\s*[+-]?[\d\s]+$/.
-# Examples:
-# '+0' canonical zero value
-# ' -123 123 123' canonical value '-123123123'
-# '1 23 456 7890' canonical value '+1234567890'
-# Output values always always in canonical form
-#
-# Actual math is done in an internal format consisting of an array
-# whose first element is the sign (/^[+-]$/) and whose remaining
-# elements are base 100000 digits with the least significant digit first.
-# The string 'NaN' is used to represent the result when input arguments
-# are not numbers, as well as the result of dividing by zero
-#
-# routines provided are:
-#
-# bneg(BINT) return BINT negation
-# babs(BINT) return BINT absolute value
-# bcmp(BINT,BINT) return CODE compare numbers (undef,<0,=0,>0)
-# badd(BINT,BINT) return BINT addition
-# bsub(BINT,BINT) return BINT subtraction
-# bmul(BINT,BINT) return BINT multiplication
-# bdiv(BINT,BINT) return (BINT,BINT) division (quo,rem) just quo if scalar
-# bmod(BINT,BINT) return BINT modulus
-# bgcd(BINT,BINT) return BINT greatest common divisor
-# bnorm(BINT) return BINT normalization
-#
-
$zero = 0;
-
+
# normalize string form of number. Strip leading zeros. Strip any
# white space and add a sign, if missing.
# Strings that are not numbers result the value 'NaN'.
@@ -125,7 +91,7 @@ sub abs { # post-normalized abs for internal use
s/^-/+/;
$_;
}
-
+
# Compares 2 values. Returns one of undef, <0, =0, >0. (suitable for sort)
sub bcmp { #(num_str, num_str) return cond_code
local($x,$y) = (&bnorm($_[$[]),&bnorm($_[$[+1]));
@@ -186,7 +152,7 @@ sub bgcd { #(num_str, num_str) return num_str
$x;
}
}
-
+
# routine to add two base 1e5 numbers
# stolen from Knuth Vol 2 Algorithm A pg 231
# there are separate routines to add and sub as per Kunth pg 233
@@ -252,7 +218,7 @@ sub mul { #(*int_num_array, *int_num_array) return int_num_array
sub bmod { #(num_str, num_str) return num_str
(&bdiv(@_))[$[+1];
}
-
+
sub bdiv { #(dividend: num_str, divisor: num_str) return num_str
local (*x, *y); ($x, $y) = (&bnorm($_[$[]), &bnorm($_[$[+1]));
return wantarray ? ('NaN','NaN') : 'NaN'
@@ -347,3 +313,74 @@ sub bpow { #(num_str, num_str) return num_str
}
1;
+__END__
+
+=head1 NAME
+
+Math::BigInt - Arbitrary size integer math package
+
+=head1 SYNOPSIS
+
+ use Math::BigInt;
+ $i = Math::BigInt->new($string);
+
+ $i->bneg return BINT negation
+ $i->babs return BINT absolute value
+ $i->bcmp(BINT) return CODE compare numbers (undef,<0,=0,>0)
+ $i->badd(BINT) return BINT addition
+ $i->bsub(BINT) return BINT subtraction
+ $i->bmul(BINT) return BINT multiplication
+ $i->bdiv(BINT) return (BINT,BINT) division (quo,rem) just quo if scalar
+ $i->bmod(BINT) return BINT modulus
+ $i->bgcd(BINT) return BINT greatest common divisor
+ $i->bnorm return BINT normalization
+
+=head1 DESCRIPTION
+
+All basic math operations are overloaded if you declare your big
+integers as
+
+ $i = new Math::BigInt '123 456 789 123 456 789';
+
+
+=over 2
+
+=item Canonical notation
+
+Big integer value are strings of the form C</^[+-]\d+$/> with leading
+zeros suppressed.
+
+=item Input
+
+Input values to these routines may be strings of the form
+C</^\s*[+-]?[\d\s]+$/>.
+
+=item Output
+
+Output values always always in canonical form
+
+=back
+
+Actual math is done in an internal format consisting of an array
+whose first element is the sign (/^[+-]$/) and whose remaining
+elements are base 100000 digits with the least significant digit first.
+The string 'NaN' is used to represent the result when input arguments
+are not numbers, as well as the result of dividing by zero.
+
+=head1 EXAMPLES
+
+ '+0' canonical zero value
+ ' -123 123 123' canonical value '-123123123'
+ '1 23 456 7890' canonical value '+1234567890'
+
+
+=head1 BUGS
+
+The current version of this module is a preliminary version of the
+real thing that is currently (as of perl5.002) under development.
+
+=head1 AUTHOR
+
+Mark Biggar, overloaded interface by Ilya Zakharevich.
+
+=cut
diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm
index a5a40b2486..969f3c2c79 100644
--- a/lib/Math/Complex.pm
+++ b/lib/Math/Complex.pm
@@ -1,18 +1,3 @@
-#
-# Perl5 Package for complex numbers
-#
-# 1994 by David Nadler
-# Coding know-how provided by Tom Christiansen, Tim Bunce, and Larry Wall
-# sqrt() added by Tom Christiansen; beware should have two roots,
-# but only returns one. (use wantarray?)
-#
-#
-# The functions "Re", "Im", and "arg" are provided.
-# "~" is used as the conjugation operator and "abs" is overloaded.
-#
-# Transcendental functions overloaded: so far only sin, cos, and exp.
-#
-
package Math::Complex;
require Exporter;
@@ -21,7 +6,7 @@ require Exporter;
# just to make use happy
-%OVERLOAD= (
+use overload
'+' => sub { my($x1,$y1,$x2,$y2) = (@{$_[0]},@{$_[1]});
bless [ $x1+$x2, $y1+$y2];
},
@@ -95,12 +80,12 @@ require Exporter;
},
qw("" stringify)
-);
+;
sub new {
- shift;
+ my $class = shift;
my @C = @_;
- bless \@C;
+ bless \@C, $class;
}
sub Re {
@@ -134,3 +119,45 @@ sub stringify {
$_ = 0 if ($_ eq '');
return $_;
}
+
+1;
+__END__
+
+=head1 NAME
+
+Math::Complex - complex numbers package
+
+=head1 SYNOPSIS
+
+ use Math::Complex;
+ $i = new Math::Complex;
+
+=head1 DESCRIPTION
+
+Complex numbers declared as
+
+ $i = Math::Complex->new(1,1);
+
+can be manipulated with overloaded math operators. The operators
+
+ + - * / neg ~ abs cos sin exp sqrt
+
+are supported as well as
+
+ "" (stringify)
+
+The methods
+
+ Re Im arg
+
+are also provided.
+
+=head1 BUGS
+
+sqrt() should return two roots, but only returns one.
+
+=head1 AUTHORS
+
+Dave Nadler, Tom Christiansen, Tim Bunce, Larry Wall.
+
+=cut
diff --git a/lib/Shell.pm b/lib/Shell.pm
index 021f175947..bb44b5398b 100644
--- a/lib/Shell.pm
+++ b/lib/Shell.pm
@@ -75,3 +75,52 @@ AUTOLOAD {
}
1;
+__END__
+
+=head1 NAME
+
+Shell - run shell commands transparently within perl
+
+=head1 SYNOPSIS
+
+See below.
+
+=head1 DESCRIPTION
+
+ Date: Thu, 22 Sep 94 16:18:16 -0700
+ Message-Id: <9409222318.AA17072@scalpel.netlabs.com>
+ To: perl5-porters@isu.edu
+ From: Larry Wall <lwall@scalpel.netlabs.com>
+ Subject: a new module I just wrote
+
+Here's one that'll whack your mind a little out.
+
+ #!/usr/bin/perl
+
+ use Shell;
+
+ $foo = echo("howdy", "<funny>", "world");
+ print $foo;
+
+ $passwd = cat("</etc/passwd");
+ print $passwd;
+
+ sub ps;
+ print ps -ww;
+
+ cp("/etc/passwd", "/tmp/passwd");
+
+That's maybe too gonzo. It actually exports an AUTOLOAD to the current
+package (and uncovered a bug in Beta 3, by the way). Maybe the usual
+usage should be
+
+ use Shell qw(echo cat ps cp);
+
+Larry
+
+
+=head1 AUTHOR
+
+Larry Wall
+
+=cut
diff --git a/lib/Text/ParseWords.pm b/lib/Text/ParseWords.pm
index 89278501d1..97d7beb896 100644
--- a/lib/Text/ParseWords.pm
+++ b/lib/Text/ParseWords.pm
@@ -9,43 +9,76 @@ use Carp;
@EXPORT = qw(shellwords quotewords);
@EXPORT_OK = qw(old_shellwords);
-# This code needs updating to use new Perl 5 features (regexp etc).
-
-# ParseWords.pm
-#
-# Usage:
-# use ParseWords;
-# @words = &quotewords($delim, $keep, @lines);
-# @words = &shellwords(@lines);
-# @words = &old_shellwords(@lines);
-
-# Hal Pomeranz (pomeranz@netcom.com), 23 March 1994
-# Permission to use and distribute under the same terms as Perl.
-# No warranty expressed or implied.
-
-# Basically an update and generalization of the old shellwords.pl.
-# Much code shamelessly stolen from the old version (author unknown).
-#
-# &quotewords() accepts a delimiter (which can be a regular expression)
-# and a list of lines and then breaks those lines up into a list of
-# words ignoring delimiters that appear inside quotes.
-#
-# The $keep argument is a boolean flag. If true, the quotes are kept
-# with each word, otherwise quotes are stripped in the splitting process.
-# $keep also defines whether unprotected backslashes are retained.
-#
+=head1 NAME
-1;
-__END__
+Text::ParseWords - parse text into an array of tokens
+=head1 SYNOPSIS
-sub shellwords {
+ use Text::ParseWords;
+ @words = &quotewords($delim, $keep, @lines);
+ @words = &shellwords(@lines);
+ @words = &old_shellwords(@lines);
+
+=head1 DESCRIPTION
+
+&quotewords() accepts a delimiter (which can be a regular expression)
+and a list of lines and then breaks those lines up into a list of
+words ignoring delimiters that appear inside quotes.
+
+The $keep argument is a boolean flag. If true, the quotes are kept
+with each word, otherwise quotes are stripped in the splitting process.
+$keep also defines whether unprotected backslashes are retained.
+
+A &shellwords() replacement is included to demonstrate the new package.
+This version differs from the original in that it will _NOT_ default
+to using $_ if no arguments are given. I personally find the old behavior
+to be a mis-feature.
+
+
+&quotewords() works by simply jamming all of @lines into a single
+string in $_ and then pulling off words a bit at a time until $_
+is exhausted.
+
+The inner "for" loop builds up each word (or $field) one $snippet
+at a time. A $snippet is a quoted string, a backslashed character,
+or an unquoted string. We fall out of the "for" loop when we reach
+the end of $_ or when we hit a delimiter. Falling out of the "for"
+loop, we push the $field we've been building up onto the list of
+@words we'll be returning, and then loop back and pull another word
+off of $_.
+
+The first two cases inside the "for" loop deal with quoted strings.
+The first case matches a double quoted string, removes it from $_,
+and assigns the double quoted string to $snippet in the body of the
+conditional. The second case handles single quoted strings. In
+the third case we've found a quote at the current beginning of $_,
+but it didn't match the quoted string regexps in the first two cases,
+so it must be an unbalanced quote and we croak with an error (which can
+be caught by eval()).
- # A &shellwords() replacement is included to demonstrate the new package.
- # This version differs from the original in that it will _NOT_ default
- # to using $_ if no arguments are given. I personally find the old behavior
- # to be a mis-feature.
+The next case handles backslashed characters, and the next case is the
+exit case on reaching the end of the string or finding a delimiter.
+Otherwise, we've found an unquoted thing and we pull of characters one
+at a time until we reach something that could start another $snippet--
+a quote of some sort, a backslash, or the delimiter. This one character
+at a time behavior was necessary if the delimiter was going to be a
+regexp (love to hear it if you can figure out a better way).
+
+=head1 AUTHORS
+
+Hal Pomeranz (pomeranz@netcom.com), 23 March 1994
+
+Basically an update and generalization of the old shellwords.pl.
+Much code shamelessly stolen from the old version (author unknown).
+
+=cut
+
+1;
+__END__
+
+sub shellwords {
local(@lines) = @_;
$lines[$#lines] =~ s/\s+$//;
&quotewords('\s+', 0, @lines);
@@ -54,37 +87,6 @@ sub shellwords {
sub quotewords {
-
-# &quotewords() works by simply jamming all of @lines into a single
-# string in $_ and then pulling off words a bit at a time until $_
-# is exhausted.
-#
-# The inner "for" loop builds up each word (or $field) one $snippet
-# at a time. A $snippet is a quoted string, a backslashed character,
-# or an unquoted string. We fall out of the "for" loop when we reach
-# the end of $_ or when we hit a delimiter. Falling out of the "for"
-# loop, we push the $field we've been building up onto the list of
-# @words we'll be returning, and then loop back and pull another word
-# off of $_.
-#
-# The first two cases inside the "for" loop deal with quoted strings.
-# The first case matches a double quoted string, removes it from $_,
-# and assigns the double quoted string to $snippet in the body of the
-# conditional. The second case handles single quoted strings. In
-# the third case we've found a quote at the current beginning of $_,
-# but it didn't match the quoted string regexps in the first two cases,
-# so it must be an unbalanced quote and we croak with an error (which can
-# be caught by eval()).
-#
-# The next case handles backslashed characters, and the next case is the
-# exit case on reaching the end of the string or finding a delimiter.
-#
-# Otherwise, we've found an unquoted thing and we pull of characters one
-# at a time until we reach something that could start another $snippet--
-# a quote of some sort, a backslash, or the delimiter. This one character
-# at a time behavior was necessary if the delimiter was going to be a
-# regexp (love to hear it if you can figure out a better way).
-
local($delim, $keep, @lines) = @_;
local(@words,$snippet,$field,$_);
diff --git a/lib/lib.pm b/lib/lib.pm
index ab19426b04..546ae87b89 100644
--- a/lib/lib.pm
+++ b/lib/lib.pm
@@ -10,7 +10,7 @@ my $archname = $Config{'archname'};
sub import {
shift;
- foreach (@_) {
+ foreach (reverse @_) {
unshift(@INC, $_);
# Put a corresponding archlib directory infront of $_ if it
# looks like $_ has an archlib directory below it.