>>>>> "Dave" == Dave Rolsky <autarch@urth.org> writes:
Dave> That's quite a maintenance challenge you've taken on!
It's all automated. Once an hour, I run this, located in my src
directory. When the gmtime rolls over, PAUSE gets tapped.
In about six weeks, I should have more distros than even Damian.
:-)
#!/usr/bin/perl
use strict;
$|++;
use FindBin qw($Bin);
BEGIN { chdir $Bin or die "Cannot chdir to $Bin: $!" }
use WWW::Mechanize;
use File::Copy;
my $CPAN_DIR = "/web/pic/CPAN";
my $CPAN_URI = "http://www.stonehenge.com/pic/CPAN";
my $CPAN_USER = "merlyn";
chomp(my $CPAN_PASSWORD = <STDIN>);
my @now = gmtime;
my ($Y, $M, $D) = ($now[5]+1900, $now[4]+1, $now[3]);
{
local @ARGV = "lib/Acme/Current.pm";
local $^I = "~";
while (<>) {
s/\$YEAR = \d+; \$MONTH = \d+; \$DAY = \d+;/\$YEAR = $Y; \$MONTH = $M; \$DAY = $D;/;
print;
}
}
system "perl Makefile.PL >/dev/null && make all test tardist </dev/null >/dev/null 2>&1";
unlink glob "*.tar"; # in case it blocked from a .gz
submit_to_cpan($_) for glob "Acme-Current-*.tar.gz";
sub submit_to_cpan {
my $local_file = shift;
my $cpan_dir_file = "$CPAN_DIR/$local_file";
return if -f $cpan_dir_file; # already submitted;
copy $local_file, $cpan_dir_file;
my $agent = WWW::Mechanize->new();
$agent->credentials('pause.perl.org:443', 'PAUSE',
$CPAN_USER, $CPAN_PASSWORD);
$agent->get('https://pause.perl.org');
$agent->follow(qr/Login/);
$agent->follow(qr/Upload a file/);
$agent->current_form->value('pause99_add_uri_uri',
"$CPAN_URI/$local_file");
$agent->click('SUBMIT_pause99_add_uri_uri');
print "$local_file submitted\n";
### print $agent->current_form->dump;
}
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Thread Previous
|
Thread Next