blib/lib/Module/Setup/Plugin.pm

filter: Statementstmt 100% 37 / 37 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 25.0% 1 / 4 totaltotal 94.9% 56 / 59 CC 6 SCAR 11.0
CC
6
Cov
100%
append_template_file
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Module/Setup/Plugin/Test/Makefile.pm ↑ Summary blib/lib/Module/Setup/Plugin/Additional.pm »
1 package Module::Setup::Plugin;
2 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 19 ▶use Path::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 19 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 19 ▶use Module::Setup::Flavor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 19 ▶use Module::Setup::Path::Dir;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub new {
12 317 ▶ my($class, %args) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
13 317 my $self = bless { %args }, $class;
14 317 weaken $self->{context};
15 317 $self->register;
16 317 $self;
17 }
18  
19 ▶sub register {}
Subroutine register: called CC=1 SCAR=0.0
Pod undocumented
20  
21 sub add_trigger {
22 335 ▶ my($self, @args) = @_;
Subroutine add_trigger: called CC=1 SCAR=0.0
Pod undocumented
23 335 $self->{context}->add_trigger(@args);
24 }
25  
26 sub append_template_file {
27 8 ▶ my($self, $context, $caller) = @_;
Subroutine append_template_file: called CC=6 SCAR=17.9
Pod documented
28 8 ▶ $caller = caller unless $caller;
Branch: 1 branch
BranchTrueFalseTotal
unless $caller 7 1 8
29 8 my @template = Module::Setup::Flavor::loader($caller);
30  
31 8 for my $tmpl (@template) {
32 10 ▶ if (exists $tmpl->{dir}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $tmpl->{'dir'}) { } 1 9 10
elsif (not exists $tmpl->{'file'}) { } 1 8 9
33 1 Module::Setup::Path::Dir->new($context->distribute->dist_path, split('/', $tmpl->{dir}))->mkpath;
34 1 next;
35 } elsif (!exists $tmpl->{file}) {
36 1 next;
37 }
38 my $options = {
39 dist_path => $context->distribute->dist_path->file(split('/', $tmpl->{file})),
40 template => $tmpl->{template},
41 8 vars => $context->distribute->template_vars,
42 content => undef,
43 };
44 8 ▶ $options->{chmod} = $tmpl->{chmod} if $tmpl->{chmod};
Branch: 1 branch
BranchTrueFalseTotal
if $tmpl->{"chmod"} 1 7 8
45 8 $context->distribute->write_template($context, $options);
46 }
47 }
48  
49 19 1;
50  
51 __END__
« blib/lib/Module/Setup/Plugin/Test/Makefile.pm ↑ Summary blib/lib/Module/Setup/Plugin/Additional.pm »