in reply to Re: Getting Modules Hot Off the Keyboard
in thread Getting Modules Hot Off the Keyboard

Talk about a rapid response! Thanks!

But, IIUYC, I can't get anything until the distribution has made it to ftp://ftp.cpan.org -- at least not through the cpan shell. For normal installation purposes, that's fine. But I was wondering if there was something I could use (other than manual downloading) for a quick look-see-and-test.

Jim Keenan

UPDATE one day later: I've decided to try hacking something which uses LWP::Simple::getstore() to retrieve the file from http://www.cpan.org, tests it, and sends a report with Test::Reporter. I'll post it when I get it somewhat functional. Thanks for all who have read this far.

UPDATE 2: Here is the aforepromised hack. It DWIMs with one key exception: The mail sent isn't showing up immediately on perl.cpan.testers (either web interface or newsgroup). This is the first time I've attempted to send mail from within a Perl program, so maybe there's something I don't understand. OTOH, when I've sent ordinary mail to that list, it has sometimes taken 12 hours to get posted.

In any event, have at it gang!

#!/usr/local/bin/perl use strict; use warnings; use Test::Reporter; use Data::Dumper; use LWP::Simple; use Getopt::Std; use Carp; $| = 1; my %opts; getopts( "vsh", \%opts ); croak Usage() if ( $opts{h} ); my $workdir = "/Users/jimk/Documents/Downloads"; chdir $workdir or croak "Unable to change to $workdir: $!"; my $screen = "$workdir/screen"; if (-f $screen) { unlink $screen or croak "Unable to unlink $screen: $!"; } my $err = "$workdir/error"; if (-f $err) { unlink $err or croak "Unable to unlink $err: $!"; } my ($module, $version, $authorpath) = @ARGV[0..2]; $module =~ s/::/-/g; my $authorid; $authorpath =~ m{/?([^/]*?)$}; $authorid = $1; my $source = "http://www.cpan.org/modules/by-authors/id/$authorpath/$m +odule-$version.tar.gz"; print "$source\n"; my $localfile = "$module-$version.tar.gz"; my $localdir = "$module-$version"; print "$localfile $localdir\n"; my $httpresponsecode = getstore($source, $localfile); print $httpresponsecode, "\n"; my $comment = q{}; system("tar xzvf $localfile > $screen 2>$err"); gather_comments($screen, $err); chdir $localdir or croak "Unable to change to $localdir: $!"; system("perl Makefile.PL > $screen 2>$err"); gather_comments($screen, $err); system("make > $screen 2>$err"); gather_comments($screen, $err); my $maketestreturn; if ($opts{v}) { $maketestreturn = system("make test TEST_VERBOSE=1 > $screen 2>$er +r"); } else { $maketestreturn = system("make test > $screen 2>$err"); } gather_comments($screen, $err); print 'return value from make test: ', $maketestreturn, "\n\n"; my $grade; unless ($maketestreturn) { $grade = 'pass'; } else { $grade = 'fail'; } $comment = q{} if $grade eq 'pass'; my $reporter = Test::Reporter->new( grade => $grade, distribution => $localdir, from => 'Jim Keenan (jkeenan_cpan_testing@yahoo.com)', comments => $comment, ); if ($opts{s}) { print "Sending mail ...\n"; $reporter->send() || croak $reporter->errstr(); } else { print $reporter->subject(), "\n"; print $reporter->from(), "\n"; print "\nREPORT:\n\n"; print $reporter->report, "\n"; print $reporter->grade(), "\n"; print "No mail sent\n"; } print "Finished\n"; sub gather_comments { my @files = @_; local $_; for (@files) { open my $fh, $_ or croak "Unable to open $_: $!"; local $/ = undef; $comment .= <$fh>; close $fh or croak "Unable to close $_: $!"; } } sub Usage { print 'Usage: "./reptest.pl [options] [distribution] [0.000] [A/A +B/ABCXYZ]"', "\n"; }

Jim Keenan

Replies are listed 'Best First'.
Re^3: Getting Modules Hot Off the Keyboard
by Corion (Patriarch) on Oct 08, 2005 at 18:44 UTC

    I think you can also set http://www.cpan.org/ (or maybe http://www.cpan.org/CPAN/ or something) as a mirror in your mirror list. CPAN.pm uses LWP to retrieve the files. I use a local mirror mounted via samba and have file://server/cpan/minicpan as my top mirror in the CPAN list.

      http://www.cpan.org/ appears to be the correct setting.

      I notice that whenever today I have attempted to 'get' or 'test' a module, the shell gives me a message like this:

      cpan> get Test::Tester CPAN: Storable loaded ok Going to read /Users/jimk/.cpan/Metadata Database was generated on Sat, 08 Oct 2005 08:01:00 GMT

      ... which suggests to me that I'm not getting the hot-off-the-keyboard distributions because the Metadata file has not yet been updated. Is that the obstacle?

      Jim Keenan

        That sounds like it could be the case - as well as having a current mirror to get the latest versions, you also need, when using CPAN/CPANPLUS, versions of the indices under $CPAN/modules/ and $CPAN/authors/ that have been updated to include recent uploads. This is done, I think, a couple of times a day.
Re^3: Getting Modules Hot Off the Keyboard
by ewilhelm (Novice) on Oct 09, 2005 at 07:20 UTC

    How hot do you want it? If they have a subversion or CVS repo, maybe you want to check that out so you can just update and set $PERL5LIB for a while to play with the new toys. I've been doing something crazy with symlinks for over a year now. It doesn't get much hotter!

      Well, now that you put it that way, maybe not quite that hot. I'm essentially looking to do a quick test on distros with which I'm already familiar and get a test report out once the distro hits CPAN.