NAME

CPAN::Testers::Common::Client - Common class for CPAN::Testers clients

SYNOPSIS

    use CPAN::Testers::Common::Client;

    my $client = CPAN::Testers::Common::Client->new(
          author   => 'RJBS',
          distname => 'Data-UUID-1.217',
          grade    => 'pass',
    );

    # what you should send to CPAN Testers, via Metabase
    my $metabase_data = $client->populate;
    my $email_body    = $client->email;

Although the recommended way is to construct your object passing as much information as possible:

    my $client = CPAN::Testers::Common::Client->new(
          distname         => 'Data-UUID-1.217',
          author           => 'Ricardo Signes',
          grade            => 'pass',
          comments         => 'this is an auto-generated report. Cheers!',
          via              => 'My Awesome Client App 1.0',

          # you should provide at least 'test_output' to the author,
          # otherwise he/she won't know what went wrong!
          configure_output => '...',
          build_output     => '...',
          test_output      => '...',

          # same as in a META.yml 2.0 structure
          prereqs => {
              runtime => {
                requires => {
                  'File::Basename' => '0',
                },
                recommends => {
                  'ExtUtils::ParseXS' => '2.02',
                },
              },
              build => {
                requires => {
                  'Test::More' => '0',
                },
              },
              # etc.
          },
          # alternatively, if the dist is expanded in a local dir and has a Meta 2.0 {json,yml} file
          # you can just point us to the build_dir and we'll extract the prereqs ourselves:
          # build_dir => '/tmp/Data-UUID-1.217/'
    );

DESCRIPTION

This module provides a common client for constructing metabase facts and the legacy email message sent to CPAN Testers in a way that is properly parsed by the extraction and report tools. It is meant to be used by all the CPAN clients (and standalone tools) that want/need to support the CPAN Testers infrastructure.

If you need to parse or write to the common CPAN Testers configuration file, please refer to the highly experimental CPAN::Testers::Common::Client::Config.

Constructor

new

Calling new() creates a new object. You must pass a hash as argument setting at least distname, author and grade. See below for their meaning.

Accessors

author

Required.

The evaluated distribution's author. Could be a PAUSE id or a full name.

distname

Required.

The distribution name, in Dist-Name-version.suffix format.

grade

Required.

The grade for the distribution's test result. Can be 'pass', 'fail', 'na' or 'unknown'.

comments

Any additional comments from the tester. Defaults to 'none provided' (but see "AUTOMATED_TESTING" below).

via

The sender module (CPAN::Reporter, CPANPLUS, etc). Defaults to "Your friendly CPAN Testers client".

command

The command used to test the distribution.

Methods

populate()

Will populate the object with information for each Metabase fact, and create the CPAN Testers email body.

Returns a data structure containing all metabase facts data.

email()

Returns a string to be used as body of the email to CPAN Testers.

This method will call populate() if populate hasn't been called yet.

metabase_data()

Returns the already populated metabase data structure. Note that this will NOT call populate() so you will get undef or cached data unless you call populate() yourself.

is_duplicate

Returns true if this report was already sent by the current user in the past, and false otherwise.

record_history

Records report into the history file (so is_duplicate() returns true for it in the future.

CONFIGURATION AND ENVIRONMENT

AUTOMATED_TESTING

If the AUTOMATED_TESTING environment variable is set to true, the default comment will be:

   this report is from an automated smoke testing program
   and was not reviewed by a human for accuracy

Otherwise, the default message is 'none provided'.

CPAN::Testers::Common::Client::Config also has some interesting environment variables.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/garu/CPAN-Testers-Common-Client

  git clone https://github.com/garu/CPAN-Testers-Common-Client.git

DIAGNOSTICS

Could not create temporary '$FILE' for prereq analysis: $DESCRIPTION

In order to analyse a distribution's pre-requirements, we must create a temporary file $FILE. The $DESCRIPTION should contain the error found.

Error parsing output from CPAN::Testers::Common::Client::PrereqCheck: $LINE

While parsing the pre-requirements result, the given $LINE couldn't be processed correctly. Please report the issue, patches will be welcome.

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-cpan-testers-common-client@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Breno G. de Oliveira <garu@cpan.org>

ACKNOWLEDGMENTS

This module was created at the 2012 Perl QA Hackathon, so a big THANK YOU is in order to all the companies and organisations that supported it, namely the Cit� des Sciences, Diabolocom, Dijkmat, DuckDuckGo, Dyn, Freeside, Hedera, Jaguar, ShadowCat, Splio, TECLIB', Weborama, EPO, $foo Magazin and Mongueurs de Perl.

Also, this module could never be done without the help, contribution and insights of David Golden, Barbie, Andreas K�nig and Tatsuhiko Miyagawa.

All bugs and mistakes are my own.

LICENCE AND COPYRIGHT

Copyright (c) 2012-2015, Breno G. de Oliveira <garu@cpan.org>. All rights reserved.

Parts of the internals in this distribution were refactored from CPAN::Reporter, Copyright (c) 2012 David Golden, and from CPAN::Version, Copyright (c) 2012 Andreas Koenig.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.