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