Project::Environment::Role - Moose role for Project::Environment
version v1.2.0
This role defines most of the logic for Project::Environment.
An instance of Path::Tiny, which defines the root path of the project as detected by Path::FindDev.
Will croak if it cannot successfully build project_root.
A name of the file to look for in the "project_root" directory to read the environment string from.
File must contain a single line with the environment name. It will attempt to chomp the line. So, this will work:
echo "develop" > .environment
Default: .environment
.environment
Full path to the "environment_filename". Basically just concatenation of project_root and environment_filename.
project_root
environment_filename
You can set a default environment in your subclass for when no environment could be detected.
package MyApp::Environment; use Moose; extends 'Project::Environment'; has '+default_environment' => (default => 'development');
A predicate method to test if a default environment is set or not.
An environment variable name to look for the value. This will always take precedence over anything.
PROJECT_ENVIRONMENT=test prove t/app.t
Default: PROJECT_ENVIRONMENT
PROJECT_ENVIRONMENT
Finally the star of the show. This attribute stores the actual value of the environment as it was established. The value is determined in the following order:
environment_variable
First, we check the value of the environment variable. If the value is set, then we use that as project_environment.
project_environment
Second, we check the .environment file in the project_root.
default_environment
Lastly, we check the default_environment attribute for a default value
If the value cannot be established, the builder will croak with an explanation.
Shortcut for "project_environment".
Roman F. <romanf@cpan.org>
This software is copyright (c) 2013 by Roman F..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Project::Environment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Project::Environment
CPAN shell
perl -MCPAN -e shell install Project::Environment
For more information on module installation, please visit the detailed CPAN module installation guide.