NAME

Parrot::Configure::Options - Process command-line options to Configure.pl

SYNOPSIS

use Parrot::Configure::Options qw( process_options );

$args = process_options( {
    mode => q{configure},
    argv => [@ARGV],
} );

DESCRIPTION

Parrot::Configure::Options exports on demand the subroutine process_options(), which processes the command-line options provided to Configure.pl or to tools/dev/reconfigure.pl.

If you provide Configure.pl with either --help or --version, process_options() will print out the appropriate message and perform a bare return, i.e., the return value will be undef. The calling script -- whether Configure.pl or a test file -- can then check for the definedness of process_options()'s return value and proceed appropriately.

An array of valid command-line option names stored internally is consulted; the program will die if an invalid option is called.

SUBROUTINES

process_options()

  • Purpose

    Process command-line options provided to Configure.pl and proceed appropriately.

  • Arguments

    One argument: Reference to a hash holding the following key-value pairs:

    mode    : 'configure', 'reconfigure' or 'file'
    argv    : reference to @ARGV; defaults to []
  • Return Value

    • --version or --help options

      Bare return (undef).

    • All other options

      Reference to a hash of option names and values.

  • Comment

    The mode element in the argument to process_options() should be set according to the following rules:

    • configure

      Command-Line Interface: Initial Parrot configuration with zero or more command-line options (other than the --file option). This is the most typical case. See Configure.pl or any test file simulating the functionality of Configure.pl in the t/configure/ or t/steps/ directories.

    • file

      Configuration-File Interface: Initial Parrot configuration where the options are stored in a configuration file whose location is the value of the sole command-line option --file.

    • reconfigure

      After Configure.pl has completed, some Parrot developers need to rerun a particular configuration step (typically, gen::makefiles) to debug revisions. tools/dev/reconfigure.pl with the --step=step::class option does this and internally calls process_options() in reconfigure mode.

NOTES

The functionality in this package originally appeared in Configure.pl. It was transferred here and refactored by James E Keenan.

SEE ALSO

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