blib/lib/Module/Setup/Plugin.pm

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