Mnet::Opts::Cli::Cache - Access Mnet::Opts::Cli options if loaded
# 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 // {}); }
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.
\%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.
Mnet
Mnet::Log::Conditional
Mnet::Opts::Cli
Mnet::Opts::Set
To install Mnet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mnet
CPAN shell
perl -MCPAN -e shell install Mnet
For more information on module installation, please visit the detailed CPAN module installation guide.