++ed by:

1 non-PAUSE user(s).

Breno G. de Oliveira

NAME

CPAN::Testers::Common::Client::Config - basic configuration for CPAN Testers clients

WARNING!!!

C:T:C:C:Config is a *very* early module and a *highly* EXPERIMENTAL one for that matter. The API WILL CHANGE. We're still moving stuff around, so please only use it if you understand and accept the consequences.

If you have any questions, please contact the author.

SYNOPSIS

    my $config = CPAN::Testers::Common::Client::Config->new(
        prompt => \&IO::Prompt::Tiny::prompt,
    );

    if ( -e $config->get_config_filename ) {
        $config->read or return;
    }
    else {
        print "CPAN Testers config file not found. Creating...";
        $config->setup;
    }

    ## perform your test logging according to $config's data

    ## send the report!
    my $reporter = Test::Reporter->new(
        from           => $config->email_from,
        transport      => $config->transport_name,
        transport_args => $config->transport_args,
        ...
    );

METHODS

new

Instantiates a new CPAN::Testers::Common::Client::Config object. It may receive the following (optional) parameters:

  • warn => \&my_warn_function

    Inject your own warning function. Defaults to CORE::warn.

  • print => \&my_print_function

    Inject your own printing function. Defaults to sub { print @_ }.

  • prompt => \&my_prompt_function

    Inject your own prompt function. Does not have a default. The function is expected to receive two values: ( $question, $default_value ), and return a scalar containing the answer. Take a look at IO::Prompt::Tiny and ExtUtils::MakeMaker's prompt() functions for suitable candidates.

    If you plan on calling "setup", make sure you pass the 'prompt' argument to new().

setup

Prompts the user and sets up the CPAN Tester's configuration file (usually $HOME/.cpanreporter/config.ini). This method requires you to have set a proper prompt function when you instantiated the object.

get_config_dir()

The base directory in which your 'config.ini' and other files reside. Defaults to the '.cpantesters' directory under your home directory (if you're using Linux or OS X) or under the 'my documents' folder (if you're running Windows).

get_config_filename()

Returns the full path for the 'config.ini' file.

CONFIGURATION AND ENVIRONMENT

  • PERL_CPAN_REPORTER_DIR

    Overrides the value for get_config_dir().

  • PERL_CPAN_REPORTER_CONFIG

    Overrides the value for get_config_filename().




Hosting generously
sponsored by Bytemark