I'm running OS 9.2.2.  In MacPerl 5.2.0r4 I was able to "chdir" to "::"
from the volume level and operate as if I was above the volume level --
e.g. <*> would return a list of volumes (e.g. hard drive and CD name).

This doesn't seem to work in MacPerl 5.6.1r2.  Is there some syntax I
can use other than 'chdir "::"' that will allow me to chdir to "above
the volume level" in MacPerl 5.6.1r2?

Thanks.

//dave

Details: Here is the output from the same script run under each version
of MacPerl:

======================================================================

MacPerl 5.2.0r4 Application, Perl version 5.004

pwd is: iMac 700 HD: OurData:Dave:Perl scripts
$newpwd is: ::::

Attempting to: chdir "::::"
Success! `pwd` returns: "iMac 700 HD:
"

Attempting to: chdir "::"
Success! `pwd` returns: "
"
List of files (volumes) at this level with <*>:
iMac 700 HD:
Photos - Nadine/Juanita/Dad:

======================================================================

MacPerl 5.6.1r2 Application, Perl version 5.006001

pwd is: iMac 700 HD: OurData:Dave:Perl scripts:
$newpwd is: ::::

Attempting to: chdir "::::"
Success! `pwd` returns: "iMac 700 HD:
"

Attempting to: chdir "::"
# No such file or directory

======================================================================

and here's the MacPerl script that generated that output:

#!perl -w

print "=" x 70, "\n";

print qq|MacPerl $MacPerl::Version, Perl version $]\n\n|;

print "pwd is: ", `pwd`;

chomp($newpwd = `pwd`);
# Add trailing : if not returned by `pwd` for diffs in MacPerl versions.

$newpwd =~ s/$/:/ unless ($newpwd =~ /:$/);
# Eliminate everything in the path but the colons, to get to the volume.

$newpwd =~ s/[^:]*(:)[^:]*/$1/g;

print qq|\$newpwd is: $newpwd\n|;
print qq|\nAttempting to: chdir "$newpwd"\n|;
if (chdir "$newpwd") {
  print qq|Success! \`pwd\` returns: "|, `pwd`, qq|"\n|;
} else {
  warn "$!\n";
}

print qq|\nAttempting to: chdir "::"\n|;
if (chdir "::") {
  print qq|Success! \`pwd\` returns: "|, `pwd`, qq|"\n|;
  # Print results of a glob if chdir was successful to "root".
  print "List of files (volumes) at this level with <*>: \n";
  print map { "$_\n" } <*>;
} else {
  warn "$!\n";
}

print "\n";


Reply via email to