HPCI

 view release on metacpan or  search on metacpan

lib/HPCI/Env.pm  view on Meta::CPAN

parameter provided:

	# only use the env is there was something explicitly put there
	if ($object->has_any_env) {
		use_env( $object->env );
	}

	# always use the env (default to %ENV if nothing explicit)
	use_env( $object->env );

HPCI uses multiple HPCI::Env objects that are cascaded.  The Group's
env object (if any) is copied and modified for each Stage's own
env object.

=head1 ATTRIBUTES

=over 4

=item * env_source

A hash to be used as the basis of the copy.

lib/HPCI/Env.pm  view on Meta::CPAN

has 'env_source' => (
	is        => 'ro',
	isa       => 'HashRef[Str]',
	lazy      => 1,
	predicate => '_has_env_source',
	builder   => '_default_env_source',
);

sub _default_env_source {
	my $self = shift;
	return $self->_has_env_cascade ? $self->env_cascade->env_source : \%ENV;
}

=item * env_cascade Maybe[Object]

If this attribute is provided, then it will be used as an object
that does the Env role that provides the default env_source value.
The HPCI::Stage object specifies its Group object for this parameter
so that if any Group env parameters were set, they will get used
as a basis for the Stage.

=cut

has 'env_cascade' => (
	is        => 'ro',
	isa       => 'Maybe[Object]',
	lazy      => 1,
	predicate => '_has_env_cascade',
	default   => undef,
);

=item * env_retain ArrayRef[Str]

=item * env_retain_pat RegexpRef

If either of these is provided, then only keys that are explicitly
listed in env_retain, or which match the pattern in env_retain_pat will be
kept.  All other keys will be filtered out.

lib/HPCI/Env.pm  view on Meta::CPAN


=item * has_any_env Bool (not settable)

This attribute is true if any attributes were initialized that
determine (potential) filtering of %ENV.  (It is potential because
if the values provided could end up "filtering" to a result that is
identical to the original %ENV.)  (The "filtering" attributes are
env_source, env_retain, env_retain_pat, env_deletem env_delete_pat,
and env_set._

It is also true if there was an env_cascade object provided and it
had any filtering attributes initialized.

=cut

has 'has_any_env' => (
	is       => 'ro',
	isa      => 'Bool',
	init_arg => undef,
	lazy     => 1,
	builder  => '_build_has_any_env',
);

sub _build_has_any_env {
	my $self = shift;
	return $self->_has_env_source
		|| $self->_has_env_retain
		|| $self->_has_env_retain_pat
		|| $self->_has_env_remove
		|| $self->_has_env_remove_pat
		|| $self->_has_env_set
		|| ($self->_has_env_cascade && $self->env_cascade->has_any_env);
}

=item * env HashRef[Str]

This is the hash resulting from the specified filtering and augmentation.

=back

=cut



( run in 0.546 second using v1.01-cache-2.11-cpan-49f99fa48dc )