MooseX::App::Plugin::Env - Read options from environment
In your base class:
package MyApp; use MooseX::App qw(Env);
In your command class:
package MyApp::SomeCommand; use MooseX::App::Command; option 'some_option' => ( is => 'rw', isa => 'Str', cmd_env => 'SOME_OPTION', ); sub run { my ($self) = @_; say "Some option is ".$self->some_option; }
In your shell
bash$ export SOME_OPTION=test bash$ myapp some_command Some option is test bash$ SOME_OPTION=test bash$ myapp some_command --some_option override Some option is override
This plugin can read options from the shell environment. Just add 'cmd_env' and a name (all uppercase and no spaces) to the options you wish to read from the environment.
To install MooseX::App, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::App
CPAN shell
perl -MCPAN -e shell install MooseX::App
For more information on module installation, please visit the detailed CPAN module installation guide.