--- lib/CPAN.pm-orig	Thu Mar 30 15:18:17 2000

+++ lib/CPAN.pm	Thu May 25 09:53:55 2000

@@ -29,6 +29,10 @@

 use Text::ParseWords ();

 use Text::Wrap;

 use File::Spec;

+if ($^O eq 'VMS') {

+    require VMS::FileUtils::Root;

+    require VMS::FileUtils::SafeName;

+}

 no lib "."; # we need to run chdir all over and we would get at wrong

             # libraries there

 

@@ -115,6 +119,7 @@

 	    $readline::rl_completion_function =

 		$readline::rl_completion_function = 'CPAN::Complete::cpl';

 	}

+	$Term::ReadLine::Stub::rl_term_set[0] = "\n" if $^O eq 'VMS';

 	# $term->OUT is autoflushed anyway

 	my $odef = select STDERR;

 	$| = 1;

@@ -583,11 +588,16 @@

 	$CPAN::Frontend->mydie($diemess);

       }

     }

+    if ($^O eq 'VMS') {

+        while (-e $lockfile) {      # may have old versions

+            last unless unlink $lockfile;

+        }

+    }

     my $fh;

     unless ($fh = FileHandle->new(">$lockfile")) {

 	if ($! =~ /Permission/) {

 	    my $incc = $INC{'CPAN/Config.pm'};

-	    my $myincc = MM->catfile($ENV{HOME},'.cpan','CPAN','MyConfig.pm');

+	    my $myincc = MM->catfile($ENV{HOME},($^O eq 'VMS'? '' : '.').'cpan','CPAN','MyConfig.pm');

 	    $CPAN::Frontend->myprint(qq{

 

 Your configuration suggests that CPAN.pm should use a working

@@ -789,6 +799,12 @@

 

 sub tidyup {

   my($self) = @_;

+  if ($^O eq 'VMS') {   # purge old versions

+    my $r = new VMS::FileUtils::Root $CPAN::Config->{'keep_source_where'};

+    my $dir = $r->rooted($CPAN::Config->{'keep_source_where'},'O_VMS');

+    $dir =~ s#\]$#...]#;

+    system("purge $dir");

+  }

   return unless -d $self->{ID};

   while ($self->{DU} > $self->{'MAX'} ) {

     my($toremove) = shift @{$self->{FIFO}};

@@ -817,16 +833,22 @@

     my $getcwd;

     $getcwd  = $CPAN::Config->{'getcwd'} || 'cwd';

     my($cwd) = CPAN->$getcwd();

+    my $root = new VMS::FileUtils::Root $dir if $^O eq 'VMS';

+    $dir = $root->rooted($dir) if $^O eq 'VMS';

     chdir $dir or Carp::croak("Can't chdir to $dir: $!");

     my $dh = DirHandle->new(File::Spec->curdir)

         or Carp::croak("Couldn't opendir $dir: $!");

-    my(@entries);

+    my($x,@entries);

     for ($dh->read) {

 	next if $_ eq "." || $_ eq "..";

 	if (-f $_) {

-	    push @entries, MM->catfile($dir,$_);

+	    $x = MM->catfile($dir,$_);

+	    $x = $root->unrooted($x) if $^O eq 'VMS';

+	    push @entries, $x;

 	} elsif (-d _) {

-	    push @entries, MM->catdir($dir,$_);

+	    $x =  MM->catdir($dir,$_);

+	    $x = $root->unrooted($x) if $^O eq 'VMS';

+	    push @entries, $x;

 	} else {

 	    $CPAN::Frontend->mywarn("Warning: weird direntry in $dir: $_\n");

 	}

@@ -841,6 +863,10 @@

     return if exists $self->{SIZE}{$dir};

     return if $CPAN::Signal;

     my($Du) = 0;

+    my $rooted = new VMS::FileUtils::Root $dir if $^O eq 'VMS';

+    my $dir2 = $dir;

+    $dir2 = $rooted->rooted($dir) if $^O eq 'VMS';

+    if ($^O ne 'VMS' || -d $dir2) {

     find(

 	 sub {

 	   $File::Find::prune++ if $CPAN::Signal;

@@ -853,8 +879,11 @@

 	     $Du += (-s _);

 	   }

 	 },

-	 $dir

+	 $dir2

 	);

+    } else {

+        $Du += -s $dir2;

+    }

     return if $CPAN::Signal;

     $self->{SIZE}{$dir} = $Du/1024/1024;

     push @{$self->{FIFO}}, $dir;

@@ -869,7 +898,11 @@

     return unless -e $dir;

     $self->debug("have to rmtree $dir, will free $self->{SIZE}{$dir}")

 	if $CPAN::DEBUG;

-    File::Path::rmtree($dir);

+    my $dir2 = $dir;

+    my $rooted = new VMS::FileUtils::Root $dir if $^O eq 'VMS';

+    $dir2 = $rooted->rooted($dir) if $^O eq 'VMS';

+

+    File::Path::rmtree($dir2);

     $self->{DU} -= $self->{SIZE}{$dir};

     delete $self->{SIZE}{$dir};

 }

@@ -1082,7 +1115,7 @@

     eval {require CPAN::Config;};       # We eval because of some

                                         # MakeMaker problems

     unless ($dot_cpan++){

-      unshift @INC, MM->catdir($ENV{HOME},".cpan");

+      unshift @INC, MM->catdir($ENV{HOME},($^O eq 'VMS'? '': '.').'cpan');

       eval {require CPAN::MyConfig;};   # where you can override

                                         # system wide settings

       shift @INC;

@@ -1121,7 +1154,7 @@

 	    }

 	}

 	unless ($configpm) {

-	    $configpmdir = MM->catdir($ENV{HOME},".cpan","CPAN");

+	    $configpmdir = MM->catdir($ENV{HOME},($^O eq 'VMS' ? '':'.').'cpan',"CPAN");

 	    File::Path::mkpath($configpmdir);

 	    $configpmtest = MM->catfile($configpmdir,"MyConfig.pm");

 	    if (-w $configpmtest) {

@@ -1985,10 +2018,22 @@

         }

     }

 

-    return $aslocal if -f $aslocal && -r _ && !($force & 1);

+    my $r if $^O eq 'VMS';

+    if ($^O eq 'VMS') {

+        my($name, $path) = File::Basename::fileparse($aslocal, '');

+        $name = VMS::FileUtils::SafeName::safe_archive($name);

+        $aslocal = File::Spec->catfile($path, $name);

+        $r = new VMS::FileUtils::Root $aslocal;

+        $aslocal  = $r->rooted($aslocal,'O_VMS');

+    }

+

+    if (-f $aslocal && -r _ && !($force & 1)) { 

+        $aslocal = $r->unrooted($aslocal,'O_VMS') if $^O eq 'VMS';

+        return $aslocal;

+    }

     my($restore) = 0;

     if (-f $aslocal){

-	rename $aslocal, "$aslocal.bak";

+	rename $aslocal, $^O eq 'VMS' ? "$aslocal-bak" : "$aslocal.bak";

 	$restore++;

     }

 

@@ -2054,6 +2099,7 @@

 	  # utime $now, $now, $aslocal; # too bad, if we do that, we

                                       # might alter a local mirror

 	  $self->debug("level[$level]") if $CPAN::DEBUG;

+	  $ret = $r->unrooted($ret,'O_VMS') if $^O eq 'VMS';

 	  return $ret;

 	} else {

 	  unlink $aslocal;

@@ -2069,9 +2115,10 @@

     sleep 2;

     $CPAN::Frontend->myprint("Cannot fetch $file\n\n");

     if ($restore) {

-	rename "$aslocal.bak", $aslocal;

+	rename $^O eq 'VMS' ? "$aslocal-bak" : "$aslocal.bak", $aslocal;

 	$CPAN::Frontend->myprint("Trying to get away with old file:\n" .

 				 $self->ls($aslocal));

+	$aslocal = $r->unrooted($aslocal,'O_VMS') if $^O eq 'VMS';

 	return $aslocal;

     }

     return;

@@ -2080,6 +2127,7 @@

 sub hosteasy {

     my($self,$host_seq,$file,$aslocal) = @_;

     my($i);

+    my ($name,$path,$r) if $^O eq 'VMS';

   HOSTEASY: for $i (@$host_seq) {

       my $url = $CPAN::Config->{urllist}[$i] || $CPAN::Defaultsite;

 	unless ($self->is_reachable($url)) {

@@ -2096,6 +2144,13 @@

 		require URI::URL;

 		my $u =  URI::URL->new($url);

 		$l = $u->path;

+		if ($^O eq 'VMS') {

+		    my ($name, $path) = File::Basename::fileparse($l, '');

+		    $name = VMS::FileUtils::SafeName::safe_archive($name);

+		    $name = File::Spec->catfile($path,$name);

+		    $r = new VMS::FileUtils::Root $path;

+		    $l = $r->rooted($name);

+		}

 	    } else { # works only on Unix, is poorly constructed, but

 		# hopefully better than nothing.

 		# RFC 1738 says fileurl BNF is

@@ -2106,16 +2161,29 @@

 		$l =~ s|^file:||;                   # assume they

                                                     # meant

                                                     # file://localhost

-		$l =~ s|^/||s unless -f $l;         # e.g. /P:

+    if ($^O eq 'VMS') {

+        my ($name, $path) = File::Basename::fileparse($l, '');

+        $name = VMS::FileUtils::SafeName::safe_archive($name);

+        $name = File::Spec->catfile($path,$name);

+        $r = new VMS::FileUtils::Root $path;

+        $l = $r->rooted($name);

+    }

+    if (! -f $l) {

+        my $l2 = $l;

+        $l2 =~ s|^/||s;

+        $l = $l2 if -f $l2;

+    }

 	    }

 	    if ( -f $l && -r _) {

+		$l = $r->unrooted($l) if $^O eq 'VMS';

 		$Thesite = $i;

 		return $l;

 	    }

 	    # Maybe mirror has compressed it?

-	    if (-f "$l.gz") {

-		$self->debug("found compressed $l.gz") if $CPAN::DEBUG;

-		CPAN::Tarzip->gunzip("$l.gz", $aslocal);

+      my $lgz =  $^O eq 'VMS' ? "$l-gz" : "$l.gz";

+	    if (-f $lgz) {

+		$self->debug("found compressed $lgz") if $CPAN::DEBUG;

+		CPAN::Tarzip->gunzip($lgz, $aslocal);

 		if ( -f $aslocal) {

 		    $Thesite = $i;

 		    return $aslocal;

@@ -2236,7 +2304,7 @@

 	  next if $funkyftp =~ /^\s*$/;

 	  my($want_compressed);

 	  my $aslocal_uncompressed;

-	  ($aslocal_uncompressed = $aslocal) =~ s/\.gz//;

+	  ($aslocal_uncompressed = $aslocal) =~ s/(\.|\-)gz//;

 	  my($source_switch) = "";

 	  if ($f eq "lynx"){

 	    $source_switch = " -source";

@@ -2407,12 +2475,17 @@

 	# then and login manually to host, using e-mail as

 	# password.

 	$CPAN::Frontend->myprint(qq{Issuing "$CPAN::Config->{'ftp'}$verbose -n"\n});

+	if ($^O ne 'VMS') {

 	unshift(

 		@dialog,

 		"open $host",

 		"user anonymous $Config::Config{'cf_email'}"

 	       );

 	$self->talk_ftp("$CPAN::Config->{'ftp'}$verbose -n", @dialog);

+	} else {

+	    $self->talk_ftp("$CPAN::Config->{'ftp'}/user=\"anonymous\"/pass=\"$Config::Config{'cf_email'}\" $host",@dialog);

+	}

+

 	($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,

 	 $atime,$mtime,$ctime,$blksize,$blocks) = stat($aslocal);

 	$mtime ||= 0;

@@ -3107,6 +3180,8 @@

     $self->{localfile} = $local_file;

     my $builddir = $CPAN::META->{cachemgr}->dir;

     $self->debug("doing chdir $builddir") if $CPAN::DEBUG;

+    my $buildroot = new VMS::FileUtils::Root $builddir if $^O eq 'VMS';

+    $builddir = $buildroot->rooted($builddir) if $^O eq 'VMS';

     chdir $builddir or Carp::croak("Couldn't chdir $builddir: $!");

     my $packagedir;

 

@@ -3124,11 +3199,11 @@

     $self->debug("Changed directory to tmp") if $CPAN::DEBUG;

     if (! $local_file) {

 	Carp::croak "bad download, can't do anything :-(\n";

-    } elsif ($local_file =~ /(\.tar\.(gz|Z)|\.tgz)$/i){

+    } elsif ($local_file =~ /(\.tar(\.|\-)(gz|Z)|\.tgz)$/i){

 	$self->untar_me($local_file);

     } elsif ( $local_file =~ /\.zip$/i ) {

 	$self->unzip_me($local_file);

-    } elsif ( $local_file =~ /\.pm\.(gz|Z)$/) {

+    } elsif ( $local_file =~ /\.pm(\.|\-)(gz|Z)$/) {

 	$self->pm2dir_me($local_file);

     } else {

 	$self->{archived} = "NO";

@@ -3147,7 +3222,18 @@

 	    $packagedir = MM->catdir($builddir,$distdir);

 	    -d $packagedir and $CPAN::Frontend->myprint("Removing previously used $packagedir\n");

 	    File::Path::rmtree($packagedir);

-	    rename($distdir,$packagedir) or Carp::confess("Couldn't rename $distdir to $packagedir: $!");

+	    my $rstatus;

+	    if ($^O eq 'VMS') {

+	        (undef, undef, my $rp1) = lstat $distdir;

+	        my $tofile = MM->catfile($builddir,$distdir);

+	        my $rp2 = ($rp1 & 0777) | 0700;

+	        chmod($rp2, $distdir);

+	        $rstatus = rename($distdir,$tofile);

+	        chmod($rp1, $tofile);

+	    } else {

+	        $rstatus = rename($distdir,$packagedir);

+	    }

+	    Carp::confess("Couldn't rename $distdir to $packagedir: $!") unless $rstatus;

 	} else {

 	    my $pragmatic_dir = $self->{'CPAN_USERID'} . '000';

 	    $pragmatic_dir =~ s/\W_//g;

@@ -3157,10 +3243,22 @@

 	    my($f);

 	    for $f (@readdir) { # is already without "." and ".."

 		my $to = MM->catdir($packagedir,$f);

-		rename($f,$to) or Carp::confess("Couldn't rename $f to $to: $!");

+		$to = MM->catfile($packagedir,$f) if $^O eq 'VMS';

+		my $rstatus;

+		if ($^O eq 'VMS') {

+		    (undef, undef, my $rp1) = lstat $f;

+		    my $rp2 = ($rp1 & 0777) | 0700;

+		    chmod($rp2, $f);

+		    $rstatus = rename($f,$to);

+		    chmod($rp1, $to);

+		} else {

+		    $rstatus = rename($f,$to);

+		}

+		Carp::confess("Couldn't rename $f to $to: $!") unless $rstatus;

 	    }

 	}

 	$self->{'build_dir'} = $packagedir;

+	$self->{'build_dir'} = $buildroot->unrooted($packagedir) if $^O eq 'VMS';

 	chdir File::Spec->updir;

 

 	$self->debug("Changed directory to .. (self is $self [".$self->as_string."])")

@@ -3176,6 +3274,7 @@

 	  if (-f $configure) {

 	    # do we have anything to do?

 	    $self->{'configure'} = $configure;

+	    $self->{'configure'} = $buildroot->unrooted($configure) if $^O eq 'VMS';

 	  } elsif (-f MM->catfile($packagedir,"Makefile")) {

 	    $CPAN::Frontend->myprint(qq{

 Package comes with a Makefile and without a Makefile.PL.

@@ -3229,7 +3328,7 @@

     my($self,$local_file) = @_;

     $self->{archived} = "pm";

     my $to = File::Basename::basename($local_file);

-    $to =~ s/\.(gz|Z)$//;

+    $to =~ s/(\.|\-)(gz|Z)$//;

     if (CPAN::Tarzip->gunzip($local_file,$to)) {

 	$self->{unwrapped} = "YES";

     } else {

@@ -3342,6 +3441,13 @@

         return;

     }

 

+    if ($^O eq 'VMS') {

+        my $r = new VMS::FileUtils::Root $local_file;

+        my $f = $r->rooted($local_file, 'O_VMS');

+        system("$CPAN::Config->{'pager'} $f");

+        return;

+    }

+

     my $fh_pager = FileHandle->new;

     local($SIG{PIPE}) = "IGNORE";

     $fh_pager->open("|$CPAN::Config->{'pager'}")

@@ -3389,8 +3495,8 @@

 	$lc_file = CPAN::FTP->localize("authors/id/@local",

 				       "$lc_want.gz",1);

 	if ($lc_file) {

-	    $lc_file =~ s/\.gz$//;

-	    CPAN::Tarzip->gunzip("$lc_file.gz",$lc_file);

+	    $lc_file =~ s/(\.|\-)gz$//;

+	    CPAN::Tarzip->gunzip("$lc_file$1gz",$lc_file);

 	} else {

 	    return;

 	}

@@ -3401,8 +3507,15 @@

 #-> sub CPAN::Distribution::MD5_check_file ;

 sub MD5_check_file {

     my($self,$chk_file) = @_;

-    my($cksum,$file,$basename);

+    my($cksum,$file,$basename,$rf,$rc);

+

     $file = $self->{localfile};

+    if ($^O eq 'VMS') {

+        $rf = new VMS::FileUtils::Root $file;

+        $file = $rf->rooted($file);

+        $rc = new VMS::FileUtils::Root $chk_file;

+        $chk_file = $rc->rooted($chk_file);

+    }

     $basename = File::Basename::basename($file);

     my $fh = FileHandle->new;

     if (open $fh, $chk_file){

@@ -3420,13 +3533,23 @@

 	Carp::carp "Could not open $chk_file for reading";

     }

 

-    if (exists $cksum->{$basename}{md5}) {

+    my ($ibase) = $basename;

+    if ($^O eq 'VMS') {

+        foreach (keys(%{$cksum})) {

+            if (lc(VMS::FileUtils::SafeName::safe_archive($_)) eq lc($basename)) {

+                $ibase = $_;

+                last;

+            }

+        }

+    }

+

+    if (exists $cksum->{$ibase}{md5}) {

 	$self->debug("Found checksum for $basename:" .

-		     "$cksum->{$basename}{md5}\n") if $CPAN::DEBUG;

+		     "$cksum->{$ibase}{md5}\n") if $CPAN::DEBUG;

 

 	open($fh, $file);

 	binmode $fh;

-	my $eq = $self->eq_MD5($fh,$cksum->{$basename}{'md5'});

+	my $eq = $self->eq_MD5($fh,$cksum->{$ibase}{'md5'},$cksum->{$ibase}{'size'});

 	$fh->close;

 	$fh = CPAN::Tarzip->TIEHANDLE($file);

 

@@ -3440,7 +3563,7 @@

 	    $md5->add($data);

 	  }

 	  my $hexdigest = $md5->hexdigest;

-	  $eq += $hexdigest eq $cksum->{$basename}{'md5-ungz'};

+	  $eq += $hexdigest eq $cksum->{$ibase}{'md5-ungz'};

 	}

 

 	if ($eq) {

@@ -3482,10 +3605,12 @@

 

 #-> sub CPAN::Distribution::eq_MD5 ;

 sub eq_MD5 {

-    my($self,$fh,$expectMD5) = @_;

+    my($self,$fh,$expectMD5,$len) = @_;

     my $md5 = MD5->new;

-    my($data);

-    while (read($fh, $data, 4096)){

+    my($n, $data);

+    while ($n = read($fh, $data, 4096)){

+      $data = substr($data,0,$len) if $^O eq 'VMS' && defined($len) && $len && $len < $n;  # VMS reads 512 byte blocks

+      $len -= $n;

       $md5->add($data);

     }

     # $md5->addfile($fh);

@@ -3597,6 +3722,9 @@

     }

     $CPAN::Frontend->myprint("\n  CPAN.pm: Going to build ".$self->id."\n\n");

     my $builddir = $self->dir;

+    my $mroot = new VMS::FileUtils::Root $builddir if $^O eq 'VMS';

+    $builddir = $mroot->rooted($builddir) if $^O eq 'VMS';

+

     chdir $builddir or Carp::croak("Couldn't chdir $builddir: $!");

     $self->debug("Changed directory to $builddir") if $CPAN::DEBUG;

 

@@ -3656,7 +3784,7 @@

 	    return;

 	  }

 	}

-	if (-f "Makefile") {

+	if (-f "Makefile" || ($^O eq 'VMS' && -f "descrip.mms")) {

 	  $self->{writemakefile} = "YES";

 	} else {

 	  $self->{writemakefile} =

@@ -3784,7 +3912,10 @@

 	exists $self->{'build_dir'} or push @e, "Has no own directory";

 	$CPAN::Frontend->myprint(join "", map {"  $_\n"} @e) and return if @e;

     }

-    chdir $self->{'build_dir'} or

+    my $builddir = $self->{'build_dir'};

+    my $buildroot = new VMS::FileUtils::Root $builddir if $^O eq 'VMS';

+    $builddir = $buildroot->rooted($builddir) if $^O eq 'VMS';

+    chdir $builddir or

 	Carp::croak("Couldn't chdir to $self->{'build_dir'}");

     $self->debug("Changed directory to $self->{'build_dir'}")

 	if $CPAN::DEBUG;

@@ -3813,7 +3944,10 @@

 	exists $self->{'build_dir'} or push @e, "Has no own directory";

 	$CPAN::Frontend->myprint(join "", map {"  $_\n"} @e) and return if @e;

     }

-    chdir $self->{'build_dir'} or

+    my $builddir = $self->{'build_dir'};

+    my $buildroot = new VMS::FileUtils::Root $builddir if $^O eq 'VMS';

+    $builddir = $buildroot->rooted($builddir) if $^O eq 'VMS';

+    chdir $builddir or

 	Carp::croak("Couldn't chdir to $self->{'build_dir'}");

     $self->debug("Changed directory to $self->{'build_dir'}") if $CPAN::DEBUG;

 

@@ -3860,7 +3994,10 @@

 

 	$CPAN::Frontend->myprint(join "", map {"  $_\n"} @e) and return if @e;

     }

-    chdir $self->{'build_dir'} or

+    my $builddir = $self->{'build_dir'};

+    my $buildroot = new VMS::FileUtils::Root $builddir if $^O eq 'VMS';

+    $builddir = $buildroot->rooted($builddir) if $^O eq 'VMS';

+    chdir $builddir or

 	Carp::croak("Couldn't chdir to $self->{'build_dir'}");

     $self->debug("Changed directory to $self->{'build_dir'}")

 	if $CPAN::DEBUG;

@@ -3872,7 +4009,7 @@

 

     my $system = join(" ", $CPAN::Config->{'make'},

 		      "install", $CPAN::Config->{make_install_arg});

-    my($stderr) = $^O =~ /Win/i ? "" : " 2>&1 ";

+    my($stderr) = $^O =~ /(Win|VMS)/i ? "" : " 2>&1 ";

     my($pipe) = FileHandle->new("$system $stderr |");

     my($makeout) = "";

     while (<$pipe>){

@@ -3927,7 +4064,11 @@

     @me = split /::/, $self->id;

     $me[-1] .= ".pm";

     $me = MM->catfile(@me);

-    $from = $self->find_bundle_file($dist->{'build_dir'},$me);

+    $me = File::Spec::Unix->catfile(@me) if $^O eq 'VMS';

+    my $builddir = $self->{'build_dir'};

+    my $buildroot = new VMS::FileUtils::Root $builddir if $^O eq 'VMS';

+    $builddir = $buildroot->rooted($builddir) if $^O eq 'VMS';

+    $from = $self->find_bundle_file($builddir,$me);

     $to = MM->catfile($todir,$me);

     File::Path::mkpath(File::Basename::dirname($to));

     File::Copy::copy($from, $to)

@@ -4504,20 +4645,29 @@

   if (MM->maybe_command($CPAN::Config->{'gzip'})

       &&

       MM->maybe_command($CPAN::Config->{'tar'})) {

-    my $system = "$CPAN::Config->{'gzip'} --decompress --stdout " .

+      my ($system, $r);

+      

+      $system = "$CPAN::Config->{'gzip'} --decompress --stdout " .

       "< $file | $CPAN::Config->{tar} xvf -";

-    if (system($system) != 0) {

+      if ($^O eq 'VMS' or system($system) != 0) {

       # people find the most curious tar binaries that cannot handle

       # pipes

-      my $system = "$CPAN::Config->{'gzip'} --decompress $file";

-      if (system($system)==0) {

+      

+        if ($^O eq 'VMS') {

+            $r = new VMS::FileUtils::Root $file;

+            $file = $r->rooted($file,'O_VMS');

+        }

+        my $file2 = $file;

+        $file2 =~ s/(\.|\-)gz$//;

+        $system = "$CPAN::Config->{'gzip'} --decompress --stdout $file >$file2";

+        if (system($system) == 0) {

 	$CPAN::Frontend->myprint(qq{Uncompressed $file successfully\n});

       } else {

-	$CPAN::Frontend->mydie(

-			       qq{Couldn\'t uncompress $file\n}

-			      );

+            $CPAN::Frontend->mydie(qq{Couldn\'t uncompress $file\n});

       }

-      $file =~ s/\.gz$//;

+      

+

+        $file =~ s/(\.|\-)gz$//;

       $system = "$CPAN::Config->{tar} xvf $file";

       $CPAN::Frontend->myprint(qq{Using Tar:$system:\n});

       if (system($system)==0) {

@@ -4525,6 +4675,7 @@

       } else {

 	$CPAN::Frontend->mydie(qq{Couldn\'t untar $file\n});

       }

+        unlink($file);

       return 1;

     } else {

       return 1;

--- lib/CPAN/FirstTime.pm-orig	Thu Mar 30 15:20:13 2000

+++ lib/CPAN/FirstTime.pm	Tue Mar 28 13:56:16 2000

@@ -17,6 +17,7 @@

 use File::Path ();

 use vars qw($VERSION);

 $VERSION = substr q$Revision: 1.39 $, 10;

+require VMS::DCLsym  if $^O eq 'VMS';

 

 =head1 NAME

 

@@ -212,8 +213,10 @@

     my $old_warn = $^W;

     local $^W if $^O eq 'MacOS';

     my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'};

+    @path = split('/', VMS::Filespec::unixpath($ENV{'PATH'})) if $^O eq 'VMS';

     local $^W = $old_warn;

     my $progname;

+    my $DCLsym = new VMS::DCLsym if $^O eq 'VMS';

     for $progname (qw/gzip tar unzip make lynx ncftpget ncftp ftp/){

       if ($^O eq 'MacOS') {

           $CPAN::Config->{$progname} = 'not_here';

@@ -239,10 +242,25 @@

 	$progcall = $Config::Config{$progname} if $Config::Config{$progname};

       }

 

+      if ($^O eq 'VMS') {

+         my $tmp = $DCLsym->getsym($progcall);

+         if (defined($tmp)) {

+            $tmp =~ s#^\s*\$##;

+            $path = $progcall;

+         }

+      }

       $path ||= find_exe($progcall,[@path]);

       warn "Warning: $progcall not found in PATH\n" unless

 	  $path; # not -e $path, because find_exe already checked that

       $ans = prompt("Where is your $progname program?",$path) || $path;

+

+      if ($^O eq 'VMS') {

+         my $tmp = $DCLsym->getsym($ans);

+         if (defined($tmp)) {

+            $tmp =~ s#^\s*\$##;

+            $ans = $tmp;

+         }

+      }

       $CPAN::Config->{$progname} = $ans;

     }

     my $path = $CPAN::Config->{'pager'} || 

