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

NAME

MooseX::App::Plugin::Env - Read options from environment

SYNOPSIS

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

DESCRIPTION

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.