On Tue, May 14, 2002 at 07:17:50AM -0600, Robert wrote:
> Hmm.  I patched, I tested, I verified, I re-patched, re-tested, etc. 
> but no workie...

I'm, like, very sorry. Please either apply this (incremental) patch
below, or just replace your Report.pm with the attached file.

Thanks,
/Autrijus/


--- lib/CPANPLUS/Internals/Report.pm    Tue May 14 21:34:58 2002
+++ Report.pm   Tue May 14 22:16:25 2002
@@ -27,15 +27,19 @@
 ### Send out testing reports
 sub _send_report {
     my ($self, %args) = @_;
-    my ($module, $buffer) = @args{qw|module buffer|};
+    my ($module, $buffer, $failed) = @args{qw|module buffer failed|};
     my $name   = $module->{module};
     my $dist   = $module->{package};
+    my $author = $self->_author_tree->{$module->{author}}{name}
+                 || $module->{author};
+    my $email  = $self->_author_tree->{$module->{author}}{email}
+                 || "$module->{author}\@cpan.org";
     my $grade  = 'pass';
 
-    if ($self->{_todo}{failed}{$name}) {
+    if ($self->{_todo}{failed}{$name} or $failed) {
         $grade = 'fail';
     }
-    elsif ($buffer =~ /^No tests defined for .* extension.\s*$/) {
+    elsif ($buffer =~ /^No tests defined for .* extension.\s*$/m) {
         $grade = 'unknown';
     }
 
@@ -67,14 +71,51 @@
 Additional comments:
 .
 
-        @inform = "$module->{author}\@cpan.org";
+        if (my @missing = $buffer =~ m/^Can't locate (\S+) in \@INC/mg) {
+            my $missing = join("\n", map {
+                s/.pm$//; s|/|::|g; $_
+            } @missing);
+
+            my $prereq  = join("\n", map {
+                s/.pm$//; s|/|::|g; "\t'$_'\t=> '0', # or a minimum workable version"
+            } @missing);
+
+            print $fh '' . << ".";
+
+Hello, $author! Thanks for uploading your works to CPAN.
+
+I noticed that the test suite seem to fail without these modules:
+
+$missing
+
+As such, adding the prerequisite module(s) to 'PREREQ_PM' in your
+Makefile.PL should solve this problem.  For example:
+
+WriteMakefile(
+    AUTHOR      => '$author ($email)',
+    ... # other information
+    PREREQ_PM   => {
+$prereq
+    }
+);
+
+If you are interested in making a more flexible Makefile.PL that can
+probe for missing dependencies and install them, ExtUtils::AutoInstall
+at <http://search.cpan.org/search?dist=ExtUtils-AutoInstall> may be
+worth a look.
+
+Thanks! :-)
+.
+        }
+
+        push @inform, "$module->{author}\@cpan.org";
     }
     elsif ($grade eq 'unknown') {
         return unless $self->_can_use( modules => { 'File::Temp' => '0.0' } );
         ($fh, $filename) = File::Temp::tempfile( UNLINK => 1 );
 
         my $stage = lc($self->{_error}->stack);
-        $stage =~ s/ failed.*//;
+        $stage = 'make test';
 
         print $fh '' . << ".";
 This is an error report generated automatically by CPANPLUS.
@@ -84,12 +125,11 @@
 
 Additional comments:
 
-Hello there! Thanks for uploading your $dist on CPAN.
+Hello, $author! Thanks for uploading your works to CPAN.
 
 Would it be too much to ask for a simple test script in the next
-release of $module->{module}'s distribution, so people can verify
-which platforms can successfully install them, as well as avoid
-regression bugs?
+release, so people can verify which platforms can successfully
+install them, as well as avoid regression bugs?
 
 A simple 't/use.t' that says:
 
@@ -108,7 +148,10 @@
 
 Thanks! :-)
 .
-        @inform = "$module->{author}\@cpan.org";
+        push @inform, "$module->{author}\@cpan.org";
+    }
+    elsif ($self->{_conf}->get_conf('cpantest') =~ /\balways_cc\b/i) {
+        push @inform, "$module->{author}\@cpan.org";
     }
 
     my @cmd = $self->_report_command(
@@ -116,6 +159,7 @@
         module   => $module,
         grade    => $grade,
         filename => $filename,
+        inform   => \@inform,
     );
 
     print "Running [@cmd]... ";
@@ -128,13 +172,12 @@
 sub _report_command {
     my ($self, %args) = @_;
     my $conf = $self->{_conf};
-    my ($dist, $module, $grade, $filename) =
-        @args{qw|dist module grade filename|};
+    my ($dist, $module, $grade, $filename, $inform) =
+        @args{qw|dist module grade filename inform|};
 
     my @cmd = (qw|cpantest -g|, $grade, qw|-auto -p|, $dist);
     push @cmd, ('-f', $filename) if defined $filename;
-    push @cmd, "$module->{author}\@cpan.org"
-        if $grade eq 'fail' or $conf->get_conf('cpantest') =~ /\balways_cc\b/i;
+    push @cmd, @{$inform};
 
     return @cmd;
 }

Attachment: Report.pm
Description: Perl program

Attachment: msg33671/pgp00000.pgp
Description: PGP signature

Reply via email to