You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by ra...@apache.org on 2003/01/03 05:43:05 UTC
cvs commit: modperl-docs/src/docs/2.0/os/win32 config.cfg faq.pod get-Perl-5.8-win32-bin
randyk 2003/01/02 20:43:05
Modified: src/docs/2.0/os/win32 config.cfg faq.pod
get-Perl-5.8-win32-bin
Log:
- avoid =item becoming bold-faced
- tweaks and enhancements to download script
Revision Changes Path
1.10 +1 -1 modperl-docs/src/docs/2.0/os/win32/config.cfg
Index: config.cfg
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/os/win32/config.cfg,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- config.cfg 2 Jan 2003 21:56:50 -0000 1.9
+++ config.cfg 3 Jan 2003 04:43:05 -0000 1.10
@@ -17,7 +17,7 @@
copy_glob => [qw(
mpinstall
- get-Perl-5.8-win32-bin
+ get-Perl-5.8-win32-bin
)],
changes => 'Changes.pod',
1.2 +13 -5 modperl-docs/src/docs/2.0/os/win32/faq.pod
Index: faq.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/os/win32/faq.pod,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- faq.pod 2 Jan 2003 07:56:04 -0000 1.1
+++ faq.pod 3 Jan 2003 04:43:05 -0000 1.2
@@ -49,12 +49,18 @@
=over
-=item Verify that mod_perl.so was compiled against the same Perl and Apache
+=item *
+
+Verify that mod_perl.so was compiled against the same Perl and Apache
versions that you are using.
-=item Check that the directory containing C<perl.exe> is in your I<PATH> environment variable.
+=item *
+
+Check that the directory containing C<perl.exe> is in your I<PATH> environment variable.
-=item Try inserting a directive
+=item *
+
+Try inserting a directive
LoadFile "C:/Path/to/your/Perl/bin/perlxx.dll"
@@ -62,9 +68,11 @@
LoadModule perl_module modules/mod_perl.so
-directive.
+directive, where F<perlxx.dll> is the Perl dll in your Perl I<bin> directory.
+
+=item *
-=item Try a reboot.
+Try a reboot.
=back
1.2 +76 -34 modperl-docs/src/docs/2.0/os/win32/get-Perl-5.8-win32-bin
Index: get-Perl-5.8-win32-bin
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/os/win32/get-Perl-5.8-win32-bin,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- get-Perl-5.8-win32-bin 2 Jan 2003 21:56:50 -0000 1.1
+++ get-Perl-5.8-win32-bin 3 Jan 2003 04:43:05 -0000 1.2
@@ -12,48 +12,67 @@
use strict;
use warnings;
-use LWP::Simple;
+use Net::FTP;
use Safe;
use Digest::MD5;
use IO::File;
use ExtUtils::MakeMaker;
+die "This is intended for Win32" unless ($^O =~ /Win32/i);
+
my $dist = 'Perl-5.8-win32-bin';
my $exe = $dist . '.exe';
-my $theoryx5 = 'ftp://theoryx5.uwinnipeg.ca/pub/other' . '/' . $dist;
-my $max = 13;
+my $theoryx5 = 'theoryx5.uwinnipeg.ca';
+my $bsize = 102400;
+my $kb = sprintf("%d", $bsize / 1024);
print <<"END";
-This script will fetch and then join the files needed for
-creating the Perl/Apache Win32 binary distribution
-$exe from $theoryx5/.
+This script will fetch and then join the files needed
+for creating the Perl/Apache Win32 binary distribution
+$exe from
+ ftp://$theoryx5/pub/other/$dist/.
If the file transfer is interrupted before all the neccessary
files are joined, run the script again in the same directory;
files successfully fetched earlier will not be downloaded again.
+A hash mark represents transfer of $kb kB.
+
END
my $ans = prompt("Fetch $exe?", 'yes');
die "Installation aborted" unless ($ans =~ /^y/i);
-my $cs = 'CHECKSUMS';
-my $checksums = $theoryx5 . '/' . $cs;
+my $ftp = Net::FTP->new($theoryx5);
+$ftp->login('anonymous', "$dist\@perl.apache.org")
+ or die "Cannot login to $theoryx5";
+$ftp->cwd("pub/other/$dist");
+my $max = get_max();
+my $cs = 'CHECKSUMS';
my $join = 'join32.exe';
-my $rjoin = $theoryx5 . '/' . $join;
+my @files = ();
# fetch the CHECKSUMS file
print "Fetching $cs ...";
-getstore($checksums, $cs);
+$ftp->ascii;
+$ftp->get($cs);
print " done!\n";
die "Failed to fetch $cs" unless (-e $cs);
+push @files, $cs;
+
+my $cksum;
+die "Cannot load $cs file" unless ( load_cs() );
# fetch the join program
-unless (-e $join) {
+if (-e $join and verifyMD5($join)) {
+ print "Skipping $join ...\n";
+}
+else {
print "Fetching $join ...";
- getstore($rjoin, $join);
+ $ftp->binary;
+ $ftp->get($join);
print " done!\n";
die "Failed to fetch $join" unless (-e $join);
unless (verifyMD5($join)) {
@@ -62,21 +81,29 @@
die;
}
}
+push @files, $join;
# fetch the split files
-my @files;
+print "\nFetching $max split files ....\n\n";
+$ftp->hash(1, $bsize);
for (1 .. $max) {
+ local $| = 1;
my $num = $_ < 10 ? "00$_" : "0$_";
my $file = $dist . '.exe.' . $num;
push @files, $file;
if (-e $file) {
- print "Skipping $file ...\n";
- next;
- }
- my $rfile = $theoryx5 . '/' . $file;
- print "Fetching $file ...";
- getstore($rfile, $file);
- print " done!\n";
+ if (verifyMD5($file)) {
+ print "Skipping $file ...\n";
+ next;
+ }
+ else {
+ unlink $file or warn "Could not unlink $file";
+ }
+ }
+ my $size = sprintf("%d", $ftp->size($file) / 1024);
+ print "\nFetching $file ($size kB) ...\n";
+ $ftp->get($file);
+ print "Done!\n";
die "Failed to fetch $file" unless (-e $file);
unless (verifyMD5($file)) {
print qq{CHECKSUM check for "$file" failed.\n};
@@ -84,8 +111,10 @@
die;
}
}
+print "\nFinished fetching split files\n";
+$ftp->quit;
-#now join them
+# now join them
my @args = ('join32');
system(@args);
die "Joining files to create $exe failed" unless (-e $exe);
@@ -93,7 +122,7 @@
# remove the temporary files, if desired
$ans = prompt('Remove temporary files?', 'yes');
if ($ans =~ /^y/i) {
- unlink @files or warn "Cannot unlink @files: $!";
+ unlink(@files) or warn "Cannot unlink temporary files: $!";
}
# run the exe, if desired
@@ -103,16 +132,13 @@
system(@args);
}
else {
- print "Double click on $exe to install\n";
+ print "\nDouble click on $exe to install\n";
}
-
-# routine to verify the CHECKSUMS for a file
+# routines to verify the CHECKSUMS for a file
# adapted from the MD5 check of CPAN.pm
-sub verifyMD5 {
- my $file = shift;
+sub load_cs {
my $fh = IO::File->new;
- my $cksum;
unless (open $fh, $cs) {
warn "Could not open $cs: $!";
return;
@@ -127,21 +153,27 @@
warn $@;
return;
}
+ return 1;
+}
+
+sub verifyMD5 {
+ my $file = shift;
+ my $fh = IO::File->new;
my ($is, $should);
- unless (open(FILE, $file)) {
+ unless (open($fh, $file)) {
warn "Cannot open $file: $!";
return;
}
- binmode(FILE);
- unless ($is = Digest::MD5->new->addfile(*FILE)->hexdigest) {
+ binmode($fh);
+ unless ($is = Digest::MD5->new->addfile($fh)->hexdigest) {
warn "Could not compute checksum for $file: $!";
- close(FILE);
+ close $fh;
return;
}
- close(FILE);
+ close $fh;
if ($should = $cksum->{$file}->{md5}) {
my $test = $is eq $should ? 1 : 0;
- printf qq{Checksum for "$file" is %s\n},
+ printf qq{ Checksum for "$file" is %s\n},
($test == 1) ? 'OK.' : 'NOT OK.';
return $test;
}
@@ -149,4 +181,14 @@
warn "Checksum data for $file not present in CHECKSUMS.\n";
return;
}
+}
+
+# get number of split files
+sub get_max {
+ my $dir = $ftp->ls();
+ my $count = 0;
+ foreach (@$dir) {
+ $count++ if m!$dist.exe.\d+!;
+ }
+ return $count;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org