File Coverage

blib/lib/DBIx/Class/Schema/PopulateMore/Inflator/Env.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 4 0.0
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 16 31.2


line stmt bran cond sub pod time code
1             package DBIx::Class::Schema::PopulateMore::Inflator::Env;
2              
3 3     3   2385 use Moo;
  3         6  
  3         15  
4             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     0 1   my ($self, $command, $string) = @_;
32            
33 0 0         if( defined $ENV{$string} )
    0          
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             1;