The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Parrot::Configure::Options::Conf::CLI - Options processing functionality for Parrot's standard command-line interface

SYNOPSIS

    use Parrot::Configure::Options::Conf::CLI qw(
        @valid_options
        $script
        %options_components
        $parrot_version
    );

DESCRIPTION

This package exports four variables on demand.

    %options_components
    @valid_options
    $script
    $parrot_version

Typically, only one of these -- %options_components -- is directly imported by Parrot::Configure::Options for use in the case where options are supplied to Configure.pl on the command-line. But all five are, in principle, importable by other packages.

%options_components

    %options_components = (
        'valid_options'  => \@valid_options,
        'script'         => $script,
        'short_circuits' => \%short_circuits,
        'conditionals'   => \&conditional_assignments,
    );

Hash with four elements keyed as follows:

  • valid_options

    Reference to an array holding a list of options are valid when configuring Parrot via the Configuration-File interface. The options are documented when you call perl Configure.pl --help. --ask is excluded because if you know enough about what options you want to put them in a file, you should be past the point of needing interactive configuration.

  • script

    Defaults to string 'Configure.pl', but may be overridden for testing purposes.

  • short_circuits

    Reference to a hash with two elements:

    • help

      Reference to subroutine print_help, which prints Configure.pl's help message. Since this subroutine is shared with another package, it is actually imported from Parrot::Configure::Options::Conf.

    • version

      Reference to subroutine print_version, which prints Configure.pl's version number. Since this subroutine is shared with another package, it is actually imported from Parrot::Configure::Options::Conf.

  • conditionals

    Reference to a subroutine private to this package which:

    • Sets default values for the debugging and maintainer options under most situations.

    • Fetches the list of configuration steps from the configuration file.

    The subroutine takes a single argument: a reference to a hash holding elements concerned with configuration, such as the valid options.

    The subroutine returns a two-argument list:

    • An augmented version of the hash reference passed in as an argument.

    • Reference to array holding list of configuration steps.

    That's probably difficult to understand at first. So here is an example of how $options_components->{conditionals} is actually used inside Parrot::Configure::Options::process_options().

        my $data;
        # $data is hash ref which gets assigned some key-value pairs
        my $steps_list_ref;
        ($data, $steps_list_ref) =
            &{ $options_components->{conditionals} }($data);

NOTES

The functionality in this package originally appeared in Configure.pl. It was transferred here and adapted for configuration by file by James E Keenan.

SEE ALSO

Configure.pl. Parrot::Configure::Options. Parrot::Configure::Options::Conf. Parrot::Configure::Options::Reconf. Parrot::Configure::Options::Conf::CLI.