1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
package DBIx::Class::Schema::PopulateMore::Inflator::Env;
use Moo;
extends 'DBIx::Class::Schema::PopulateMore::Inflator';
=head1 NAME
DBIx::Class::Schema::PopulateMore::Inflator::Env - inflated via the %ENV hash
=head1 DESCRIPTION
So that a value in a fixture or populate can be set via %ENV. Checks the
command and it's upcased version.
=head1 ATTRIBUTES
This class defines the following attributes.
=head1 METHODS
This module defines the following methods.
=head2 inflate($command, $string)
This is called by Populate's dispatcher, when there is a match.
=cut
sub inflate
{
my ($self, $command, $string) = @_;
if( defined $ENV{$string} )
{
return $ENV{$string};
}
elsif( defined $ENV{uc $string} )
{
return $ENV{uc $string};
}
else
{
$command->exception_cb->("No match for $string found in %ENV");
}
return;
}
=head1 AUTHOR
Please see L<DBIx::Class::Schema::PopulateMore> For authorship information
=head1 LICENSE
Please see L<DBIx::Class::Schema::PopulateMore> For licensing terms.
=cut
1;
|