blib/lib/MYDan/Project/Deploy.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 44 CC 3 SCAR 13.9
CC
3
Cov
0%
new
6.0
conf
6.0
BEGIN
2.0
CRAP 4.0
1 package MYDan::Project::Deploy;
2  
3 use strict;
4 use warnings;
5  
6 $|++;
7  
8 use MYDan::Util::OptConf;
9 my ( %o, %api );
10 BEGIN{
11 %o = MYDan::Util::OptConf->load()->dump('project');
12 %api = MYDan::Util::OptConf->load()->dump('api');
13 };
14  
15 sub new
16 {
17 my ( $class, %self ) = @_;
18  
19 die "name undef" unless $self{name};
20 bless \%self, ref $class || $class;
21 }
22  
23 sub conf
24 {
25 my $this = shift;
26  
27 my $conf = eval{ YAML::XS::LoadFile "$o{deploy}/$this->{name}" };
28 die "load conf: $@" if $@;
29 $conf->{repo} ||= "$api{addr}/download/package/$this->{name}";
30 $conf->{version} = shift;
31  
32 return $conf;
33 }
34  
35 1;