CPAN-Reporter

 view release on metacpan or  search on metacpan

lib/CPAN/Reporter/Config.pm  view on Meta::CPAN

    send_report => {
        default => 'default:ask/yes pass/na:yes',
        prompt => "Do you want to send the report?",
        validate => \&_validate_grade_action_pair,
        info => <<'HERE',
By default, CPAN::Reporter will prompt you for confirmation that
the test report should be sent before actually doing it. This
gives the opportunity to skip sending particular reports if
you need to (e.g. if you caused the failure). This option takes
"grade:action" pairs.
HERE
    },
    transport => {
        default  => 'Metabase uri https://metabase.cpantesters.org/api/v1/ id_file metabase_id.json',
        prompt   => 'Which transport system will be used to transmit the reports?',
        validate => \&_validate_transport,
        info     => <<'HERE',
CPAN::Reporter sends your reports over HTTPS using Metabase. This option lets
you set a different uri, transport mechanism and metabase profile path. If you
are receiving HTTPS errors, you may change the uri to use plain HTTP, though
this is not recommended. Unless you know what you're doing, just accept
the default value.
HERE
    },
    send_duplicates => {
        default => 'default:no',
        prompt => "This report is identical to a previous one.  Send it anyway?",
        validate => \&_validate_grade_action_pair,
        info => <<'HERE',
CPAN::Reporter records tests grades for each distribution, version and
platform.  By default, duplicates of previous results will not be sent at
all, regardless of the value of the "send_report" option.  This option takes
"grade:action" pairs.
HERE
    },
    send_PL_report => {
        prompt => "Do you want to send the PL report?",
        default => undef,
        validate => \&_validate_grade_action_pair,
    },
    send_make_report => {
        prompt => "Do you want to send the make/Build report?",
        default => undef,
        validate => \&_validate_grade_action_pair,
    },
    send_test_report => {
        prompt => "Do you want to send the test report?",
        default => undef,
        validate => \&_validate_grade_action_pair,
    },
    send_skipfile => {
        prompt => "What file has patterns for things that shouldn't be reported?",
        default => undef,
        validate => \&_validate_skipfile,
    },
    cc_skipfile => {
        prompt => "What file has patterns for things that shouldn't CC to authors?",
        default => undef,
        validate => \&_validate_skipfile,
    },
    command_timeout => {
        prompt => "If no timeout is set by CPAN, halt system commands after how many seconds?",
        default => undef,
        validate => \&_validate_seconds,
    },
    email_to => {
        default => undef,
    },
    editor => {
        default => undef,
    },
    debug => {
        default => undef,
    },
    retry_submission => {
        default => undef,
    },
    '_store_problems_in_dir' => { #experimental
        default => undef,
    },
    '_problem_log' => { #experimental
        default => undef,
    },
);

sub _config_spec { return %option_specs }

#--------------------------------------------------------------------------#
# _generate_profile
#
# Run 'metabase-profile' in the .cpanreporter directory
#--------------------------------------------------------------------------#

sub _generate_profile {
    my ($id_file, $config) = @_;

    my $cmd = IPC::Cmd::can_run('metabase-profile');
    return unless $cmd;

    # XXX this is an evil assumption about email addresses, but
    # might do for simple cases that users might actually provide

    my @opts = ("--output" => $id_file);
    my $email = $config->{email_from};

    if ($email =~ /\A(.+)\s+<([^>]+)>\z/ ) {
        push @opts, "--email"   => $2;
        my $name = $1;
        $name =~ s/\A["'](.*)["']\z/$1/;
        push ( @opts, "--name"    => $1)
            if length $name;
    }
    else {
        push @opts, "--email"   => $email;
    }

    # XXX profile 'secret' is really just a generated API key, so we
    # can create something fairly random for the user and use that
    push @opts, "--secret"      => sprintf("%08x", rand(2**31));

    return scalar IPC::Cmd::run(

lib/CPAN/Reporter/Config.pm  view on Meta::CPAN


Action prompt options take one or more space-separated "grade:action" pairs,
which are processed left to right.

  edit_report = fail:ask/yes pass:no

An action by itself is taken as a default to be used for any grade which does
not have a grade-specific action.  A default action may also be set by using
the word "default" in place of a grade.

  edit_report = ask/no
  edit_report = default:ask/no

A grade by itself is taken to have the action "yes" for that grade.

  edit_report = default:no fail

Multiple grades may be specified together by separating them with a slash.

  edit_report = pass:no fail/na/unknown:ask/yes

The action prompt options included in interactive configuration are:

=over

=item *

C<<< edit_report = <grade:action> ... >>> -- edit the test report before sending?
(default:askE<sol>no passE<sol>na:no)

=item *

C<<< send_report = <grade:action> ... >>> -- should test reports be sent at all?
(default:askE<sol>yes passE<sol>na:yes)

=back

Note that if C<<< send_report >>> is set to "no", CPAN::Reporter will still go through
the motions of preparing a report, but will discard it rather than send it.

A better way to disable CPAN::Reporter temporarily is with the CPAN option
C<<< test_report >>>:

  cpan> o conf test_report 0

=head2 Mail Server (DEPRECATED)

CPAN::Reporter used to send mail directly to perl.org mail servers. The
C<<< smtp_server >>> option is now deprecated and will be ignored if it exists.

=head1 ADVANCED CONFIGURATION OPTIONS

These additional options are only necessary in special cases, for example if
the default editor cannot be found or if reports shouldn't be sent in
certain situations or for automated testing, and so on.

=over

=item *

C<<< command_timeout >>> -- if greater than zero and the CPAN config is
C<<< inactivity_timeout >>> is not set, then any commands executed by CPAN::Reporter
will be halted after this many seconds; useful for unattended smoke testing
to stop after some amount of time; generally, this should be large --
900 seconds or more -- as some distributions' tests take quite a long time to
run.  On MSWin32, L<Win32::Job> is a needed and trying to kill a process may
actually deadlock in some situations -- so use at your own risk.

=item *

C<<< editor = <editor> >>> -- editor to use to edit the test report; if not set,
Test::Reporter will use environment variables C<<< VISUAL >>>, C<<< EDITOR >>> or C<<< EDIT >>>
(in that order) to find an editor

=item *

C<<< retry_submission >>> -- if greater than zero, CPAN::Reporter will try to
resend the report after a few seconds in case the first attempt fails.

=item *

C<<< send_duplicates = <grade:action> ... >>> -- should duplicates of previous
reports be sent, regardless of C<<< send_report >>>? (default:no)

=item *

C<<< send_PL_report = <grade:action> ... >>> -- if defined, used in place of
C<<< send_report >>> during the PL phase

=item *

C<<< send_make_report = <grade:action> ... >>> -- if defined, used in place of
C<<< send_report >>> during the make phase

=item *

C<<< send_test_report = <grade:action> ... >>> -- if defined, used in place of
C<<< send_report >>> during the test phase

=item *

C<<< send_skipfile = <skipfile> >>> -- filename containing regular expressions (one
per line) to match against the distribution ID (e.g.
'AUTHORE<sol>Dist-Name-0.01.tar.gz'); the report will not be sent if a match is
found; non-absolute filename must be in the .cpanreporter config directory;

=back

If these options are manually added to the configuration file, they will
be included (and preserved) in subsequent interactive configuration.

=head2 Skipfile regular expressions

Skip files are expected to have one regular expression per line and will be
matched against the distribution ID, composed of the author's CPAN ID and the
distribution tarball name.

     DAGOLDEN/CPAN-Reporter-1.00.tar.gz

Lines that begin with a sharp (#) are considered comments and will not be
matched.  All regular expressions will be matched case insensitive and will



( run in 2.001 seconds using v1.01-cache-2.11-cpan-2ed5026b665 )