Here's script I'm using:
http://svn.trouchelle.com/perl/cpan/0sendreports.pl
Yours has two flaws: first, you remove a report file before submitting it to Metabase. If something goes wrong, your
report is lost. Second, you should check if you really removed report file. I had a problem when my filesystem was set
to readonly and 4 reports was sent over and over again for few thousand times.
About the issue with different information in tail log and report, it was addressed some time ago and Metabase contains
correct information. Probably, a server part responsible for writing log files seems to still have the same problem and
is using client information and not report's one. But Metabase itself should be unaffected by this.
Chris Marshall wrote:
I'm trying to implement a way to submit CPAN Testers
reports generated offline from the report files. Here
is the script I came up with and just tried. The problem
is it appears from the tail/log.txt from the metabase site
that some of the information of the sending perl
instance (cygwin perl) may have gotten mixed in
with the information of the test report (asperl). Is this
a bug in the metabase transport or is there something
else I need to add to make this work?
Thanks in advance,
Chris
use Test::Reporter;
use Test::Reporter::Transport::Metabase;
$reports_dir = 'reports';
opendir(DIR, $reports_dir);
@reports = grep { /^[^.]/&& -f "$reports_dir/$_" } readdir(DIR);
closedir DIR;
print join("\n", "Got reports to process: ", @reports) . "\n";
foreach $file (sort @reports) {
unless (-e "$reports_dir/$file") { next }
# load file and set in
$reporter = Test::Reporter->new();
$reporter->transport('Metabase');
$reporter->transport_args(
uri => 'http://metabase.cpantesters.org/api/v1/',
id_file => '/cygdrive/f/chm/.cpanreporter/chm.json',
);
# output file being processed
print "processing... $file\n";
# sanitize email address in report
### `perl -i -p -e 's|[email protected]|[email protected]|g'
/usr/share/reports/$file`;
eval('$report = $reporter->read("$reports_dir/$file")');
$error = $reporter->errstr();
$error ? print $error."\n"&& next : undef;
# clean up file after processing
print " rm -f /usr/share/reports/$file\n";
# send report in
eval('$retval = $report->send()');
$error = $reporter->errstr();
$error ? (print $error."\n") : undef;
}
--
Serguei Trouchelle