Balancer/Command/Init.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 36 CC 2 SCAR 11.5
CC
2
Cov
0%
mkpath
6.0
run
2.0
BEGIN
2.0
CRAP 3.1
1 package HTTP::Balancer::Command::Init;
2  
3 use Modern::Perl;
4  
5 use Moose;
6  
7 with qw( HTTP::Balancer::Role::Command );
8  
9 use Path::Tiny;
10  
11 sub run {
12 my ($self, ) = @_;
13  
14 require HTTP::Balancer::Model;
15 $self->mkpath( map { $_->model_dir } HTTP::Balancer::Model->models );
16 }
17  
18 sub mkpath {
19 my ($self, @path) = @_;
20  
21 for my $path (map { path($_) } @path) {
22 if ($path->exists) {
23 say "$path has existed.";
24 $path->mkpath;
25 } else {
26 say "create $path";
27 $path->mkpath;
28 }
29 }
30  
31 $self;
32 }
33  
34 1;
35 __END__