Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

marto's scratchpad

by marto (Archbishop)
on Jun 02, 2004 at 07:58 UTC ( #359256=scratchpad: print w/replies, xml ) Need Help??

Junk

#!/usr/bin/perl use strict; use warnings; use CPAN::Mirrors; use LWP::UserAgent; use Digest::SHA qw(sha256_hex); my $sha256 = '8e3fccbf4c7e87c2df7c1e756fc17666a708bab8b36fd2004163756 +51d9b86e1'; my $path = 'authors/id/R/RS/RSCHUPP/PAR-Packer-1.047.tar.gz'; my $mirrors = CPAN::Mirrors->new( 'MIRRORED.BY' ); my @mirrors = $mirrors->mirrors(); my ( @goodsha, @badsha, @problemmirror ); my $ua = LWP::UserAgent->new(); $ua->max_redirect( 6 ); foreach my $cpan ( @mirrors ){ if ( $cpan->{http} ){ print "Checking Mirror: $cpan->{http}\n"; my $url = $cpan->{http} . $path; my $res = $ua->get( $url ); if ( $res->is_success ){ my $file = $res->decoded_content( charset => 'none' ); my $file_sha = sha256_hex( $file ); if ( $file_sha eq $sha256 ){ print "Matching SHA\n"; push @goodsha, $url; }else{ print "Warning: SHA does not match!\n"; print "Got : $file_sha\nExpected: $sha256\n"; push @badsha, $url; } }else{ print "Couldn't download $url\n"; push @problemmirror, $url; } } } print "'Bad' mirrorsn\n\n" . join( "\n", @badsha ) if ( @badsha ); print "\n'Unreachable' mirrors\n\n" . join( "\n", @problemmirror ) if +( @problemmirror );

Replacement Makefile.PL for File::Repl.

# File::Repl # # Version # $Source: d:/src/perl/File/Repl/RCS/Makefile.PL $ # $Revision: 1.4 $ # $State: Exp $ # # Start comments/code here - will not be processed into manual pages # # Copyright - Dave Roberts 2000,2001 # # Revision history: # $Log: Makefile.PL $ # Revision 1.4 2011/11/25 07:29:24 Dave.Roberts # added COMPRESS arguments # # Revision 1.3 2001/06/27 12:33:57 jj768 # Changes to ignore the RCS directory # # #********************************************************************* +********* use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( 'NAME' => 'File::Repl', 'VERSION_FROM' => 'Repl.pm', 'PREREQ_PM' => { 'File::Find' => 0, 'File::HomeDir' => 0, 'File::Copy' => '2.03', 'File::Basename' => '2.6' }, 'dist' => { ZIP => 'wzzip.exe', ZIPFLAGS => '-P', COMPRESS => 'gzip --best --force', }, 'MAN3PODS' => { 'Repl.pm' => 'blib/man3/File::Repl.3', }, 'PM' => { 'Repl.pm' => '$(INST_LIBDIR)/Repl.pm', } ); if ( ( $^O eq 'MSWin32' ) or ( $^O eq 'cygwin' ) ) { $WriteMakefileArgs{PREREQ_PM}{'Win32::API'} = '0'; } WriteMakefile(%WriteMakefileArgs); package MY; sub postamble { <<"END_OF_POSTAMBLE"; pm_to_blib: README README: Repl.pm \tpod2text Repl.pm >README \tpod2html Repl.pm >Repl.html END_OF_POSTAMBLE } # Just to make it ignore editor backup files. sub libscan { $_ = $_[1]; if ( m/(RCS|CVS|SCCS)/i || m/[~%]$/ || m/\.(orig|rej)$/ ) { print " Ignoring $_\n"; return ''; } return $_; }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2019-07-21 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (7 votes). Check out past polls.

    Notices?