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

NAME

Mnet::Opts::Cli::Cache - Access Mnet::Opts::Cli options if loaded

SYNOPSIS

    # requried to use this module
    use Mnet::Opts::Cli::Cache;

    # sample sub with input opts arg overlaid onto cached cli opts
    sub example {
        my $opts = Mnet::Opts::Cli::Cache::get(shift // {});
    }

DESCRIPTION

This module can be used to access command line options that may be in effect, depending on if the Mnet::Opts::Cli module new method was used to parse them.

The following is a typical usage example, showing a subroutine that allows for an Mnet::Opts object to be created using an input opts hash reference which is overaid onto any cached cli options that may have already been parsed by the running script:

Refer to the Mnet::Opts::Cli and Mnet::Opts modules for more info.

get

    \%opts = Mnet::Opts::Cli::Cache::get(\%input);
    or (\%opts, @extras) = Mnet::Opts::Cli::Cache::get(\%input);

This function can be used to retrieve a hash reference of parsed cli options and a list of extra cli arguments. An optional input hash reference can be used to specify options that will override any cached cli opts.

Note that the returned hash reference of cached cli options will be empty if the Mnet::Opts::Cli->new method was not called yet by the running script and no input hash reference was supplied. This can be used to tell if a script is using Mnet::Opts::Cli for command line option parsing.

Also note that this function can be called in list context to return a hash ref of cached cli options and extra arguments paresed from the commmand line, or in scalar context to return cached cli options only.

Refer to the SYNOPSIS section of this perldoc for usage examples and more info.

SEE ALSO

Mnet

Mnet::Log::Conditional

Mnet::Opts::Cli

Mnet::Opts::Set