This patch describes the changes made in ActivePerl build 522 over the
official Perl 5.005_03 sources.
Summary of changes in build 522:
* Important bug fixes imported from Perl 5.6 development track. See
below for descriptions of these.
* Typo in CGI.pm, and a PerlEx compatibility tweak.
* Make "perl -V" output reflect ActiveState build.
* Add Win32::BuildNumber() for compatibility.
* Add resources to perl.exe and perlcore.dll.
The ActivePerl Release Notes contain an informal summary of these
changes. These can be viewed at:
http://www.activestate.com/ActivePerl/docs/Perl-Win32/release.htm
The included patch may be applied to Perl 5.005_03 sources using the
GNU patch utility. e.g:
c:\perl5.005_03> patch -p1 -N < this_file
---------------------------------------------------------------------------
diff -ruN perl5.005_03/MANIFEST AP522_source/MANIFEST
--- perl5.005_03/MANIFESTFri Oct 15 17:45:43 1999
+++ AP522_source/MANIFESTMon Nov 01 15:11:31 1999
@@ -502,6 +502,7 @@
lib/File/Find.pmRoutines to do a find
lib/File/Path.pmDo things like `mkdir -p' and `rm -r'
lib/File/Spec.pmportable operations on file names
+lib/File/Spec/Functions.pmFunction interface to File::Spec object methods
lib/File/Spec/Mac.pmportable operations on Mac file names
lib/File/Spec/OS2.pmportable operations on OS2 file names
lib/File/Spec/Unix.pmportable operations on Unix file names
@@ -710,6 +711,7 @@
plan9/setup.rcPlan9 port: script for easy build+install
plan9/versnumPlan9 port: script to print version number
pod/MakefileMake pods into something else
+pod/Win32.podDocumentation for Win32 extras
pod/buildtocgenerate perltoc.pod
pod/checkpods.PLTool to check for common errors in pods
pod/perl.podTop level perl man page
diff -ruN perl5.005_03/cop.h AP522_source/cop.h
--- perl5.005_03/cop.hFri Oct 15 17:45:44 1999
+++ AP522_source/cop.hMon Nov 01 15:11:32 1999
@@ -72,6 +72,7 @@
/* destroy arg array */\
av_clear(cxsub.argarray);\
AvREAL_off(cxsub.argarray);\
+ AvREIFY_on(cxsub.argarray);\
}\
if (cxsub.cv) {\
if (!(CvDEPTH(cxsub.cv) = cxsub.olddepth))\
diff -ruN perl5.005_03/dump.c AP522_source/dump.c
--- perl5.005_03/dump.cFri Oct 15 17:45:44 1999
+++ AP522_source/dump.cMon Nov 01 15:11:32 1999
@@ -219,6 +219,8 @@
else if (o->op_type == OP_CONST) {
if (o->op_private & OPpCONST_BARE)
sv_catpv(tmpsv, ",BARE");
+ if (o->op_private & OPpCONST_STRICT)
+sv_catpv(tmpsv, ",STRICT");
}
else if (o->op_type == OP_FLIP) {
if (o->op_private & OPpFLIP_LINENUM)
diff -ruN perl5.005_03/eg/example.pl AP522_source/eg/example.pl
--- perl5.005_03/eg/example.plWed Dec 31 16:00:00 1969
+++ AP522_source/eg/example.plMon Nov 01 15:11:32 1999
@@ -0,0 +1 @@
+print "Hello from ActivePerl!";
diff -ruN perl5.005_03/embed.h AP522_source/embed.h
--- perl5.005_03/embed.hFri Oct 15 17:45:45 1999
+++ AP522_source/embed.hMon Nov 01 15:11:33 1999
@@ -415,6 +415,7 @@
#define ninstrPerl_ninstr
#define no_aelemPerl_no_aelem
#define no_dir_funcPerl_no_dir_func
+#define no_bareword_allowedPerl_no_bareword_allowed
#define no_fh_allowedPerl_no_fh_allowed
#define no_funcPerl_no_func
#define no_helemPerl_no_helem
diff -ruN perl5.005_03/ext/SDBM_File/sdbm/dbe.c AP522_source/ext/SDBM_File/sdbm/dbe.c
--- perl5.005_03/ext/SDBM_File/sdbm/dbe.cFri Oct 15 17:45:46 1999
+++ AP522_source/ext/SDBM_File/sdbm/dbe.cMon Nov 01 15:11:34 1999
@@ -138,7 +138,7 @@
putchar('"');
for (i = 0; i < db.dsize; i++) {
-if (isprint(db.dptr[i]))
+if (isprint((unsigned char)db.dptr[i]))
putchar(db.dptr[i]);
else {
putchar('\\');
@@ -171,7 +171,10 @@
*p = '\f';
else if (*s == 't')
*p = '\t';
-else if (isdigit(*s) && isdigit(*(s + 1)) && isdigit(*(s + 2))) {
+else if (isdigit((unsigned char)*s)
+ && isdigit((unsigned char)*(s + 1))
+ && isdigit((unsigned char)*(s + 2)))
+{
i = (*s++ - '0') << 6;
i |= (*s++ - '0') << 3;
i |= *s - '0';
diff -ruN perl5.005_03/global.sym AP522_source/global.sym
--- perl5.005_03/global.symFri Oct 15 17:45:46 1999
+++ AP522_source/global.symMon Nov 01 15:11:35 1999
@@ -502,6 +502,7 @@
newXSUB
nextargv
ninstr
+no_bareword_allowed
no_fh_allowed
no_op
oopsAV
diff -ruN perl5.005_03/iperlsys.h AP522_source/iperlsys.h
--- perl5.005_03/iperlsys.hFri Oct 15 17:45:47 1999
+++ AP522_source/iperlsys.hMon Nov 01 15:11:35 1999
@@ -450,10 +450,12 @@
virtual intPutenv(const char *envstring, int &err) = 0;
virtual char *LibPath(char *patchlevel) =0;
virtual char *SiteLibPath(char *patchlevel) =0;
+ virtual intUname(struct utsname *name, int &err) =0;
};
#define PerlEnv_putenv(str)PL_piENV->Putenv((str), ErrorNo())
#define PerlEnv_getenv(str)PL_piENV->Getenv((str), ErrorNo())
+#define PerlEnv_uname(name)PL_piENV->Uname((name), ErrorNo())
#ifdef WIN32
#define PerlEnv_lib_path(str)PL_piENV->LibPath((str))
#define PerlEnv_sitelib_path(str)PL_piENV->SiteLibPath((str))
@@ -463,6 +465,7 @@
#define PerlEnv_putenv(str)putenv((str))
#define PerlEnv_getenv(str)getenv((str))
+#define PerlEnv_uname(name)uname((name))
#endif/* PERL_OBJECT */
diff -ruN perl5.005_03/lib/CGI/Carp.pm AP522_source/lib/CGI/Carp.pm
--- perl5.005_03/lib/CGI/Carp.pmFri Oct 15 17:45:47 1999
+++ AP522_source/lib/CGI/Carp.pmMon Nov 01 15:11:35 1999
@@ -242,11 +242,13 @@
}
# The mod_perl package Apache::Registry loads CGI programs by calling
-# eval. These evals don't count when looking at the stack backtrace.
+# eval, as does PerlEx. These evals don't count when looking at the
+# stack backtrace.
sub _longmess {
my $message = Carp::longmess();
my $mod_perl = exists $ENV{MOD_PERL};
- $message =~ s,eval[^\n]+Apache/Registry\.pm.*,,s if $mod_perl;
+ my $PerlEx = exists($ENV{'GATEWAY_INTERFACE'}) && $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-PerlEx/;
+ $message =~ s,eval[^\n]+(Apache/Registry\.pm|\s*PerlEx::Precompiler).*,,s if $mod_perl || $PerlEx;
return( $message );
}
@@ -307,8 +309,10 @@
END
;
my $mod_perl = exists $ENV{MOD_PERL};
+ my $PerlEx = exists($ENV{'GATEWAY_INTERFACE'}) && $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-PerlEx/;
+
print STDOUT "Content-type: text/html\n\n"
-unless $mod_perl;
+unless $mod_perl || $PerlEx;
if ($CUSTOM_MSG) {
if (ref($CUSTOM_MSG) eq 'CODE') {
diff -ruN perl5.005_03/lib/CGI.pm AP522_source/lib/CGI.pm
--- perl5.005_03/lib/CGI.pmFri Oct 15 17:45:47 1999
+++ AP522_source/lib/CGI.pmMon Nov 01 15:11:35 1999
@@ -123,7 +123,7 @@
# Turn on special checking for Doug MacEachern's modperl
if (exists $ENV{'GATEWAY_INTERFACE'}
&&
- ($MOD_PERL = $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-Perl/))
+ ($MOD_PERL = $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-Perl\//))
{
$| = 1;
require Apache;
diff -ruN perl5.005_03/lib/ExtUtils/MM_Unix.pm AP522_source/lib/ExtUtils/MM_Unix.pm
--- perl5.005_03/lib/ExtUtils/MM_Unix.pmFri Oct 15 17:45:48 1999
+++ AP522_source/lib/ExtUtils/MM_Unix.pmMon Nov 01 15:11:36 1999
@@ -1695,8 +1695,7 @@
my($install_variable,$search_prefix,$replace_prefix);
- # The rule, taken from Configure, is that if prefix contains perl,
- # we shape the tree
+ # If the prefix contains perl, Configure shapes the tree as follows:
# perlprefix/lib/ INSTALLPRIVLIB
# perlprefix/lib/pod/
# perlprefix/lib/site_perl/INSTALLSITELIB
@@ -1708,6 +1707,11 @@
# prefix/lib/perl5/site_perl/INSTALLSITELIB
# prefix/bin/INSTALLBIN
# prefix/lib/perl5/man/INSTALLMAN1DIR
+ #
+ # The above results in various kinds of breakage on various
+ # platforms, so we cope with it as follows: if prefix/lib/perl5
+ # or prefix/lib/perl5/man exist, we'll replace those instead
+ # of /prefix/{lib,man}
$replace_prefix = qq[\$\(PREFIX\)];
for $install_variable (qw/
@@ -1716,36 +1720,45 @@
/) {
$self->prefixify($install_variable,$configure_prefix,$replace_prefix);
}
- $search_prefix = $configure_prefix =~ /perl/ ?
-$self->catdir($configure_prefix,"lib") :
-$self->catdir($configure_prefix,"lib","perl5");
+ my $funkylibdir = $self->catdir($configure_prefix,"lib","perl5");
+ $funkylibdir = '' unless -d $funkylibdir;
+ $search_prefix = $funkylibdir || $self->catdir($configure_prefix,"lib");
if ($self->{LIB}) {
$self->{INSTALLPRIVLIB} = $self->{INSTALLSITELIB} = $self->{LIB};
$self->{INSTALLARCHLIB} = $self->{INSTALLSITEARCH} =
$self->catdir($self->{LIB},$Config{'archname'});
- } else {
-$replace_prefix = $self->{PREFIX} =~ /perl/ ?
- $self->catdir(qq[\$\(PREFIX\)],"lib") :
-$self->catdir(qq[\$\(PREFIX\)],"lib","perl5");
+ }
+ else {
+if (-d $self->catdir($self->{PREFIX},"lib","perl5")) {
+ $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib", "perl5");
+}
+else {
+ $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib");
+}
for $install_variable (qw/
INSTALLPRIVLIB
INSTALLARCHLIB
INSTALLSITELIB
INSTALLSITEARCH
- /) {
+ /)
+{
$self->prefixify($install_variable,$search_prefix,$replace_prefix);
}
}
- $search_prefix = $configure_prefix =~ /perl/ ?
-$self->catdir($configure_prefix,"man") :
- $self->catdir($configure_prefix,"lib","perl5","man");
- $replace_prefix = $self->{PREFIX} =~ /perl/ ?
-$self->catdir(qq[\$\(PREFIX\)],"man") :
- $self->catdir(qq[\$\(PREFIX\)],"lib","perl5","man");
+ my $funkymandir = $self->catdir($configure_prefix,"lib","perl5","man");
+ $funkymandir = '' unless -d $funkymandir;
+ $search_prefix = $funkymandir || $self->catdir($configure_prefix,"man");
+ if (-d $self->catdir($self->{PREFIX},"lib","perl5", "man")) {
+$replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib", "perl5", "man");
+ }
+ else {
+$replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"man");
+ }
for $install_variable (qw/
INSTALLMAN1DIR
INSTALLMAN3DIR
- /) {
+ /)
+ {
$self->prefixify($install_variable,$search_prefix,$replace_prefix);
}
@@ -1846,7 +1859,7 @@
push @defpath, $component if defined $component;
}
$self->{PERL} ||=
- $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
+ $self->find_perl(5.0, [ $self->canonpath($^X), 'miniperl','perl','perl5',"perl$]" ],
\@defpath, $Verbose );
# don't check if perl is executable, maybe they have decided to
# supply switches with perl
diff -ruN perl5.005_03/lib/ExtUtils/xsubpp AP522_source/lib/ExtUtils/xsubpp
--- perl5.005_03/lib/ExtUtils/xsubppFri Oct 15 17:45:48 1999
+++ AP522_source/lib/ExtUtils/xsubppMon Nov 01 15:11:36 1999
@@ -1327,8 +1327,7 @@
##endif
#XSCAPI(boot_$Module_cname)
#[[
-# SetCPerlObj(pPerl);
-# boot__CAPI_entry(cv);
+# boot_CAPI_handler(cv, boot__CAPI_entry, pPerl);
#]]
##endif/* PERL_CAPI */
EOF
diff -ruN perl5.005_03/lib/File/Compare.pm AP522_source/lib/File/Compare.pm
--- perl5.005_03/lib/File/Compare.pmFri Oct 15 17:45:48 1999
+++ AP522_source/lib/File/Compare.pmMon Nov 01 15:11:36 1999
@@ -6,10 +6,10 @@
require Exporter;
use Carp;
-$VERSION = '1.1001';
+$VERSION = '1.1002';
@ISA = qw(Exporter);
@EXPORT = qw(compare);
-@EXPORT_OK = qw(cmp);
+@EXPORT_OK = qw(cmp compare_text);
$Too_Big = 1024 * 1024 * 2;
@@ -22,14 +22,12 @@
croak("Usage: compare( file1, file2 [, buffersize]) ")
unless(@_ == 2 || @_ == 3);
- my $from = shift;
- my $to = shift;
- my $closefrom=0;
- my $closeto=0;
- my ($size, $fromsize, $status, $fr, $tr, $fbuf, $tbuf);
- local(*FROM, *TO);
- local($\) = '';
+ my ($from,$to,$size) = @_;
+ my $text_mode = defined($size) && (ref($size) eq 'CODE' || $size < 0);
+ my ($fromsize,$closefrom,$closeto);
+ local (*FROM, *TO);
+
croak("from undefined") unless (defined $from);
croak("to undefined") unless (defined $to);
@@ -40,9 +38,11 @@
*FROM = $from;
} else {
open(FROM,"<$from") or goto fail_open1;
-binmode FROM;
+unless ($text_mode) {
+ binmode FROM;
+ $fromsize = -s FROM;
+}
$closefrom = 1;
-$fromsize = -s FROM;
}
if (ref($to) &&
@@ -52,32 +52,45 @@
*TO = $to;
} else {
open(TO,"<$to") or goto fail_open2;
-binmode TO;
+binmode TO unless $text_mode;
$closeto = 1;
}
- if ($closefrom && $closeto) {
+ if (!$text_mode && $closefrom && $closeto) {
# If both are opened files we know they differ if their size differ
goto fail_inner if $fromsize != -s TO;
}
- if (@_) {
-$size = shift(@_) + 0;
-croak("Bad buffer size for compare: $size\n") unless ($size > 0);
- } else {
-$size = $fromsize;
-$size = 1024 if ($size < 512);
-$size = $Too_Big if ($size > $Too_Big);
+ if ($text_mode) {
+local $/ = "\n";
+my ($fline,$tline);
+while (defined($fline = <FROM>)) {
+ goto fail_inner unless defined($tline = <TO>);
+ if (ref $size) {
+# $size contains ref to comparison function
+goto fail_inner if &$size($fline, $tline);
+ } else {
+goto fail_inner if $fline ne $tline;
+ }
+}
+goto fail_inner if defined($tline = <TO>);
}
+ else {
+unless (defined($size) && $size > 0) {
+ $size = $fromsize;
+ $size = 1024 if $size < 512;
+ $size = $Too_Big if $size > $Too_Big;
+}
- $fbuf = '';
- $tbuf = '';
- while(defined($fr = read(FROM,$fbuf,$size)) && $fr > 0) {
-unless (defined($tr = read(TO,$tbuf,$fr)) and $tbuf eq $fbuf) {
- goto fail_inner;
+my ($fr,$tr,$fbuf,$tbuf);
+$fbuf = $tbuf = '';
+while(defined($fr = read(FROM,$fbuf,$size)) && $fr > 0) {
+ unless (defined($tr = read(TO,$tbuf,$fr)) && $tbuf eq $fbuf) {
+goto fail_inner;
+ }
}
+goto fail_inner if defined($tr = read(TO,$tbuf,$size)) && $tr > 0;
}
- goto fail_inner if (defined($tr = read(TO,$tbuf,$size)) && $tr > 0);
close(TO) || goto fail_open2 if $closeto;
close(FROM) || goto fail_open1 if $closefrom;
@@ -93,7 +106,7 @@
fail_open2:
if ($closefrom) {
-$status = $!;
+my $status = $!;
$! = 0;
close FROM;
$! = $status unless $!;
@@ -104,6 +117,18 @@
*cmp = \&compare;
+sub compare_text {
+ my ($from,$to,$cmp) = @_;
+ croak("Usage: compare_text( file1, file2 [, cmp-function])")
+unless @_ == 2 || @_ == 3;
+ croak("Third arg to compare_text() function must be a code reference")
+if @_ == 3 && ref($cmp) ne 'CODE';
+
+ # Using a negative buffer size puts compare into text_mode too
+ $cmp = -1 unless defined $cmp;
+ compare($from, $to, $cmp);
+}
+
1;
__END__
@@ -128,6 +153,18 @@
File::Compare::cmp is a synonym for File::Compare::compare. It is
exported from File::Compare only by request.
+
+File::Compare::compare_text does a line by line comparison of the two
+files. It stops as soon as a difference is detected. compare_text()
+accepts an optional third argument: This must be a CODE reference to
+a line comparison function, which returns 0 when both lines are considered
+equal. For example:
+
+ compare_text($file1, $file2)
+
+is basically equivalent to
+
+ compare_text($file1, $file2, sub {$_[0] ne $_[1]} )
=head1 RETURN
diff -ruN perl5.005_03/lib/File/Copy.pm AP522_source/lib/File/Copy.pm
--- perl5.005_03/lib/File/Copy.pmFri Oct 15 17:45:48 1999
+++ AP522_source/lib/File/Copy.pmMon Nov 01 15:11:36 1999
@@ -64,6 +64,7 @@
&& !$to_a_handle
&& !($from_a_handle && $^O eq 'os2' )# OS/2 cannot handle handles
&& !($from_a_handle && $^O eq 'mpeix')# and neither can MPE/iX.
+&& !($from_a_handle && $^O eq 'MSWin32')
)
{
return syscopy($from, $to);
@@ -186,6 +187,11 @@
# preserve MPE file attributes.
return system('/bin/cp', '-f', $_[0], $_[1]) == 0;
};
+ } elsif ($^O eq 'MSWin32') {
+*syscopy = sub {
+ return 0 unless @_ == 2;
+ return Win32::CopyFile(@_, 1);
+};
} else {
*syscopy = \©
}
@@ -272,9 +278,9 @@
structure. For Unix systems, this is equivalent to the simple
C<copy> routine. For VMS systems, this calls the C<rmscopy>
routine (see below). For OS/2 systems, this calls the C<syscopy>
-XSUB directly.
+XSUB directly. For Win32 systems, this calls C<Win32::CopyFile>.
-=head2 Special behaviour if C<syscopy> is defined (VMS and OS/2)
+=head2 Special behaviour if C<syscopy> is defined (OS/2, VMS and Win32)
If both arguments to C<copy> are not file handles,
then C<copy> will perform a "system copy" of
diff -ruN perl5.005_03/lib/File/Spec/Functions.pm AP522_source/lib/File/Spec/Functions.pm
--- perl5.005_03/lib/File/Spec/Functions.pmWed Dec 31 16:00:00 1969
+++ AP522_source/lib/File/Spec/Functions.pmMon Nov 01 15:11:36 1999
@@ -0,0 +1,91 @@
+package File::Spec::Functions;
+
+use File::Spec;
+use strict;
+
+use vars qw(@ISA @EXPORT @EXPORT_OK);
+
+require Exporter;
+
+@ISA = qw(Exporter);
+
+@EXPORT = qw(
+canonpath
+catdir
+catfile
+curdir
+rootdir
+updir
+no_upwards
+file_name_is_absolute
+path
+);
+
+@EXPORT_OK = qw(
+devnull
+tmpdir
+splitpath
+splitdir
+catpath
+abs2rel
+rel2abs
+);
+
+foreach my $meth (@EXPORT, @EXPORT_OK) {
+ my $sub = File::Spec->can($meth);
+ no strict 'refs';
+ *{$meth} = sub {&$sub('File::Spec', @_)};
+}
+
+
+1;
+__END__
+
+=head1 NAME
+
+File::Spec::Functions - portably perform operations on file names
+
+=head1 SYNOPSIS
+
+use File::Spec::Functions;
+$x = catfile('a','b');
+
+=head1 DESCRIPTION
+
+This module exports convenience functions for all of the class methods
+provided by File::Spec.
+
+For a reference of available functions, please consult L<File::Spec::Unix>,
+which contains the entire set, and which is inherited by the modules for
+other platforms. For further information, please see L<File::Spec::Mac>,
+L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>.
+
+=head2 Exports
+
+The following functions are exported by default.
+
+canonpath
+catdir
+catfile
+curdir
+rootdir
+updir
+no_upwards
+file_name_is_absolute
+path
+
+
+The following functions are exported only by request.
+
+devnull
+tmpdir
+splitpath
+splitdir
+catpath
+abs2rel
+rel2abs
+
+=head1 SEE ALSO
+
+File::Spec, File::Spec::Unix, File::Spec::Mac, File::Spec::OS2,
+File::Spec::Win32, File::Spec::VMS, ExtUtils::MakeMaker
diff -ruN perl5.005_03/lib/File/Spec/Mac.pm AP522_source/lib/File/Spec/Mac.pm
--- perl5.005_03/lib/File/Spec/Mac.pmFri Oct 15 17:45:48 1999
+++ AP522_source/lib/File/Spec/Mac.pmMon Nov 01 15:11:36 1999
@@ -1,26 +1,17 @@
package File::Spec::Mac;
-use Exporter ();
-use Config;
use strict;
-use File::Spec;
-use vars qw(@ISA $VERSION $Is_Mac);
-
-$VERSION = '1.0';
-
+use vars qw(@ISA);
+require File::Spec::Unix;
@ISA = qw(File::Spec::Unix);
-$Is_Mac = $^O eq 'MacOS';
-
-Exporter::import('File::Spec', '$Verbose');
-
=head1 NAME
File::Spec::Mac - File::Spec for MacOS
=head1 SYNOPSIS
-C<require File::Spec::Mac;>
+ require File::Spec::Mac; # Done internally by File::Spec if needed
=head1 DESCRIPTION
@@ -37,8 +28,8 @@
=cut
sub canonpath {
- my($self,$path) = @_;
- $path;
+ my ($self,$path) = @_;
+ return $path;
}
=item catdir
@@ -84,20 +75,17 @@
=cut
-# ';
-
sub catdir {
shift;
my @args = @_;
-$args[0] =~ s/:$//;
-my $result = shift @args;
-for (@args) {
-s/:$//;
-s/^://;
-$result .= ":$_";
+ my $result = shift @args;
+ $result =~ s/:$//;
+ foreach (@args) {
+s/:$//;
+s/^://;
+$result .= ":$_";
}
- $result .= ":";
-$result;
+ return "$result:";
}
=item catfile
@@ -118,50 +106,69 @@
=cut
sub catfile {
- my $self = shift @_;
+ my $self = shift;
my $file = pop @_;
return $file unless @_;
my $dir = $self->catdir(@_);
-$file =~ s/^://;
+ $file =~ s/^://;
return $dir.$file;
}
=item curdir
-Returns a string representing of the current directory.
+Returns a string representing the current directory.
=cut
sub curdir {
- return ":" ;
+ return ":";
+}
+
+=item devnull
+
+Returns a string representing the null device.
+
+=cut
+
+sub devnull {
+ return "Dev:Null";
}
=item rootdir
Returns a string representing the root directory. Under MacPerl,
returns the name of the startup volume, since that's the closest in
-concept, although other volumes aren't rooted there. On any other
-platform returns '', since there's no common way to indicate "root
-directory" across all Macs.
+concept, although other volumes aren't rooted there.
=cut
sub rootdir {
#
-# There's no real root directory on MacOS. If you're using MacPerl,
-# the name of the startup volume is returned, since that's the closest in
-# concept. On other platforms, simply return '', because nothing better
-# can be done.
+# There's no real root directory on MacOS. The name of the startup
+# volume is returned, since that's the closest in concept.
#
-if($Is_Mac) {
- require Mac::Files;
-my $system = Mac::Files::FindFolder(&Mac::Files::kOnSystemDisk,
- &Mac::Files::kSystemFolderType);
-$system =~ s/:.*$/:/;
-return $system;
-} else {
-return '';
- }
+ require Mac::Files;
+ my $system = Mac::Files::FindFolder(&Mac::Files::kOnSystemDisk,
+ &Mac::Files::kSystemFolderType);
+ $system =~ s/:.*$/:/;
+ return $system;
+}
+
+=item tmpdir
+
+Returns a string representation of the first existing directory
+from the following list or '' if none exist:
+
+ $ENV{TMPDIR}
+
+=cut
+
+my $tmpdir;
+sub tmpdir {
+ return $tmpdir if defined $tmpdir;
+ $tmpdir = $ENV{TMPDIR} if -d $ENV{TMPDIR};
+ $tmpdir = '' unless defined $tmpdir;
+ return $tmpdir;
}
=item updir
@@ -185,11 +192,11 @@
=cut
sub file_name_is_absolute {
- my($self,$file) = @_;
-if ($file =~ /:/) {
-return ($file !~ m/^:/);
-} else {
-return (! -e ":$file");
+ my ($self,$file) = @_;
+ if ($file =~ /:/) {
+return ($file !~ m/^:/);
+ } else {
+return (! -e ":$file");
}
}
@@ -207,14 +214,8 @@
# The concept is meaningless under the MacPerl application.
# Under MPW, it has a meaning.
#
- my($self) = @_;
-my @path;
-if(exists $ENV{Commands}) {
-@path = split /,/,$ENV{Commands};
-} else {
- @path = ();
-}
- @path;
+ return unless exists $ENV{Commands};
+ return split(/,/, $ENV{Commands});
}
=back
@@ -226,5 +227,3 @@
=cut
1;
-__END__
-
diff -ruN perl5.005_03/lib/File/Spec/OS2.pm AP522_source/lib/File/Spec/OS2.pm
--- perl5.005_03/lib/File/Spec/OS2.pmFri Oct 15 17:45:48 1999
+++ AP522_source/lib/File/Spec/OS2.pmMon Nov 01 15:11:36 1999
@@ -1,36 +1,42 @@
package File::Spec::OS2;
-#use Config;
-#use Cwd;
-#use File::Basename;
use strict;
-require Exporter;
-
-use File::Spec;
use vars qw(@ISA);
-
-Exporter::import('File::Spec',
- qw( $Verbose));
-
+require File::Spec::Unix;
@ISA = qw(File::Spec::Unix);
-$ENV{EMXSHELL} = 'sh'; # to run `commands`
+sub devnull {
+ return "/dev/nul";
+}
sub file_name_is_absolute {
- my($self,$file) = @_;
- $file =~ m{^([a-z]:)?[\\/]}i ;
+ my ($self,$file) = @_;
+ return scalar($file =~ m{^([a-z]:)?[\\/]}i);
}
sub path {
- my($self) = @_;
- my $path_sep = ";";
my $path = $ENV{PATH};
$path =~ s:\\:/:g;
- my @path = split $path_sep, $path;
- foreach(@path) { $_ = '.' if $_ eq '' }
- @path;
+ my @path = split(';',$path);
+ foreach (@path) { $_ = '.' if $_ eq '' }
+ return @path;
}
+my $tmpdir;
+sub tmpdir {
+ return $tmpdir if defined $tmpdir;
+ my $self = shift;
+ foreach (@ENV{qw(TMPDIR TEMP TMP)}, qw(/tmp /)) {
+next unless defined && -d;
+$tmpdir = $_;
+last;
+ }
+ $tmpdir = '' unless defined $tmpdir;
+ $tmpdir =~ s:\\:/:g;
+ $tmpdir = $self->canonpath($t