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|dcol...@gmail.com|dcol...@cpan.org|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;
}

Reply via email to