File Coverage

blib/lib/SRS/EPP/Proxy/ConfigFromFile.pm
Criterion Covered Total %
statement 6 15 40.0
branch 0 4 0.0
condition n/a
subroutine 2 3 66.6
pod n/a
total 8 22 36.3


line stmt bran cond sub pod time code
1             package SRS::EPP::Proxy::ConfigFromFile;
2             {
3             $SRS::EPP::Proxy::ConfigFromFile::VERSION = '0.22';
4             }
5              
6 1     1   2277 use Moose::Role;
  1         2  
  1         11  
7             with 'MooseX::ConfigFromFile', { -excludes => "new_with_config" };
8              
9             # this package is a monkeypatch for MooseX::ConfigFromFile, which
10             # unnecessarily uses metaprogramming to retrieve the default value
11             # - as it does not use the logic that the regular constructor does,
12             # specifying eg a sub to the default breaks it.
13             # See rt.cpan.org#57023
14              
15             sub new_with_config {
16 0     0     my ($class, %opts) = @_;
17              
18 0           my $configfile;
19              
20 0 0         if(defined $opts{configfile}) {
21 0           $configfile = $opts{configfile}
22             }
23             else {
24 0           $configfile = $class->configfile
25             }
26              
27 0 0         if(defined $configfile) {
28 0           %opts = (%{$class->get_config_from_file($configfile)}, %opts);
  0            
29             }
30              
31 0           $class->new(%opts);
32             }
33              
34 1     1   5958 no Moose::Role;
  1         2  
  1         5  
35             1;
36