App-Env
view release on metacpan or search on metacpan
Take as an example the situation where an application's environment is
stored in /usr/local/myapp/setup on one host and /opt/local/myapp/setup
on another. One could include logic in a single "App::Env::myapp" module
which would recognize which file is appropriate. If there are multiple
applications, this gets messy. A cleaner method is to have separate
site-specific modules (e.g. "App::Env::LAN1::myapp" and
"App::Env::LAN2::myapp"), and switch between them based upon the
APP_ENV_SITE environment variable.
The logic for setting that variable might be encoded in an
App::Env::Site module to transparently automate things:
package App::Env::Site;
my %LAN1 = map { ( $_ => 1 ) } qw( sneezy breezy queasy );
my %LAN2 = map { ( $_ => 1 ) } qw( dopey mopey ropey );
use Sys::Hostname;
if ( $LAN1{hostname()} )
{
README.mkdn view on Meta::CPAN
Take as an example the situation where an application's environment is
stored in `/usr/local/myapp/setup` on one host and
`/opt/local/myapp/setup` on another. One could include logic in a
single `App::Env::myapp` module which would recognize which file is
appropriate. If there are multiple applications, this gets messy. A
cleaner method is to have separate site-specific modules (e.g.
`App::Env::LAN1::myapp` and `App::Env::LAN2::myapp`), and switch
between them based upon the **APP\_ENV\_SITE** environment variable.
The logic for setting that variable might be encoded in an
**App::Env::Site** module to transparently automate things:
package App::Env::Site;
my %LAN1 = map { ( $_ => 1 ) } qw( sneezy breezy queasy );
my %LAN2 = map { ( $_ => 1 ) } qw( dopey mopey ropey );
use Sys::Hostname;
if ( $LAN1{hostname()} )
{
lib/App/Env.pm view on Meta::CPAN
Take as an example the situation where an application's environment is
stored in F</usr/local/myapp/setup> on one host and
F</opt/local/myapp/setup> on another. One could include logic in a
single C<App::Env::myapp> module which would recognize which file is
appropriate. If there are multiple applications, this gets messy. A
cleaner method is to have separate site-specific modules (e.g.
C<App::Env::LAN1::myapp> and C<App::Env::LAN2::myapp>), and switch
between them based upon the B<APP_ENV_SITE> environment variable.
The logic for setting that variable might be encoded in an
B<App::Env::Site> module to transparently automate things:
package App::Env::Site;
my %LAN1 = map { ( $_ => 1 ) } qw( sneezy breezy queasy );
my %LAN2 = map { ( $_ => 1 ) } qw( dopey mopey ropey );
use Sys::Hostname;
if ( $LAN1{hostname()} )
{
( run in 0.646 second using v1.01-cache-2.11-cpan-a1d94b6210f )