| CPAN-Test-Reporter documentation | Contained in the CPAN-Test-Reporter distribution. |
CPAN::Test::Reporter - Report test results of a package retrieved from CPAN
my $report = CPAN::Test::Reporter->new;
$report->which_perl(path to the perl binary we tested with);
$report->grade(pass|fail|na|unknown);
$report->package(module name);
$report->test_results(our build and/or make test results);
$report->comments(other commentary on the module);
$report->send(to whom);
CPAN::Test::Reporter uniformly posts package test results in support of the cpan-testers project. See http://testers.cpan.org/ for details.
NOTE TO TESTERS: this module will currently send its output email to cpan-workers@perl.org, which might not be what you want. You can set $CPAN::Test::Reporters::CPAN_TESTERS to another email address if you prefer.
Creates a new reporter object.
grade($grade) indicates the success or failure of the package's builtin tests, and is one of:
grade meaning
----- -------
pass all tests included with the package passed
fail some tests failed
na the package does not work on this platform
unknown the package did not include tests
Specifies the version of perl you just used to test the module.
my $r = new CPAN::Test::Reporter; $r->which_perl('5.6.1'); is($r->{which_perl}, '5.6.1', "Set the perl version");
Sets the name of the package you're working on, for example Foo-Bar-0.01 There are no restrictions on what you put here -- it was found that even requiring it to end in a dash and a version number was too restrictive for use in the wild.
Sets the results for the test. $results is in the form of a string, presumably as provided by CPAN::Smoke.
Sends the email to cpan-testers and Cc's the mail to the recipients listed. Uses full email addresses.
Copyright (c) 1999 Kurt Starsinic, 2001 Kirrily Robert.
This program is free software; you may redistribute it
and/or modify it under the same terms as Perl itself.
CPAN::Smoke
Kirrily "Skud" Robert <skud@cpan.org>, based on the cpantest script by Kurt Starsinic <Kurt.Starsinic@isinet.com>
| CPAN-Test-Reporter documentation | Contained in the CPAN-Test-Reporter distribution. |
#!/usr/bin/perl -w # # Kirrily "Skud" Robert <skud@cpan.org> # $Id$ use strict; package CPAN::Test::Reporter; use Getopt::Long; use Mail::Send; use Config; use Carp; use CPAN; use vars '$VERSION'; $VERSION = '0.02';
my $CPAN_TESTERS = 'cpan-workers@perl.org'; use vars '%Config';
sub new { my $self = {}; $self->{comments} = "[ None ]"; bless $self; return $self; }
sub grade { my ($self, $grade) = @_; my %grades = ( # Legal grades: 'pass' => "all tests pass", 'fail' => "some tests fail", 'na' => "package will not work on this platform", 'unknown' => "package did not include tests", ); Carp::carp "grade argument is required" unless $grade; Carp::carp "grade '$grade' is invalid" unless $grades{$grade}; $self->{grade} = $grade; }
sub which_perl { my ($self, $version) = @_; $self->{which_perl} = $version; }
sub package { my ($self, $package) = @_; $self->{package} = $package; }
sub test_results { my ($self, $test_results) = @_; $self->{test_results} = $test_results; }
sub comments { my ($self, $comments) = @_; $self->{comments} = $comments; }
sub send { my ($self, @recipients) = @_; my $report = qq( This distribution has been tested as part of the cpan-testers effort to test as many new uploads to CPAN as possible. See http://testers.cpan.org/ Please cc any replies to cpan-testers\@perl.org to keep other test volunteers informed and to prevent any duplicate effort. Comments: $self->{comments} Test results: $self->{test_results} Perl version: $self->{which_perl} ); $report .= Config::myconfig(); my $subject = uc($self->{grade}) . " $self->{package} $Config{archname} $Config{osvers}"; my $msg = new Mail::Send Subject => $subject, To => $CPAN_TESTERS; if (@recipients) { $msg->cc(build_cc(@recipients)); } $msg->set('X-reported-via', "CPAN::Test::Reporter version $VERSION"); my $fh = $msg->open; print $fh $report; $fh->close; }
sub build_cc { my @recipients = @_; return join(", ", @recipients); }
return "FALSE"; # true value ;)
Sets your comments on the test.