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

Mnet::Opts::Cli::Cache can be used to access command line options that may be in effect, depending on if the Mnet::Opts::Cli new method was loaded, as in the typical usage example above.

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

METHODS

Mnet::Opts::Cli::Cache implements the functions listed below.

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 document for usage examples and more info.

SEE ALSO

Mnet

Mnet::Log::Conditional

Mnet::Opts

Mnet::Opts::Cli

Mnet::Opts::Set