Make/Recipe.pm

filter: Statementstmt 91.6% 22 / 24 Branchbran 50.0% 1 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 77.5% 31 / 40 CC 4 SCAR 14.8
CC
4
Cov
77%
fill_env
9.5
BEGIN
1.0
BEGIN
1.0
CRAP 4.4
« Make/Docker/Image.pm ↑ Summary Make/DBI/Schema.pm »
1 package Beam::Make::Recipe;
2 11 our $VERSION = '0.003';
3 # ABSTRACT: The base class for Beam::Make recipes
4  
5 #pod =head1 SYNOPSIS
6 #pod
7 #pod package My::Recipe;
8 #pod use v5.20;
9 #pod use Moo;
10 #pod use experimental qw( signatures );
11 #pod extends 'Beam::Make::Recipe';
12 #pod
13 #pod # Make the recipe
14 #pod sub make( $self ) {
15 #pod ...;
16 #pod }
17 #pod
18 #pod # Return a Time::Piece object for when this recipe was last
19 #pod # performed, or 0 if it can't be determined.
20 #pod sub last_modified( $self ) {
21 #pod ...;
22 #pod }
23 #pod
24 #pod =head1 DESCRIPTION
25 #pod
26 #pod This is the base L<Beam::Make> recipe class. Extend this to build your
27 #pod own recipe components.
28 #pod
29 #pod =head1 REQUIRED METHODS
30 #pod
31 #pod =head2 make
32 #pod
33 #pod This method performs the work of the recipe. There is no return value.
34 #pod
35 #pod =head2 last_modified
36 #pod
37 #pod This method returns a L<Time::Piece> object for when this recipe was last
38 #pod performed, or C<0> otherwise. This method could use the L</cache> object
39 #pod to read a cached date. See L<Beam::Make::Cache> for more information.
40 #pod
41 #pod =head1 SEE ALSO
42 #pod
43 #pod L<Beam::Make>
44 #pod
45 #pod =cut
46  
47 11 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 11 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 11 ▶use Time::Piece;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 11 ▶use experimental qw( signatures postderef );
Subroutine BEGIN: called CC=1 SCAR=0.0
52  
53 #pod =attr name
54 #pod
55 #pod The name of the recipe. This is the key in the C<Beamfile> used to refer
56 #pod to this recipe.
57 #pod
58 #pod =cut
59  
60 11 has name => ( is => 'ro', required => 1 );
61  
62 #pod =attr requires
63 #pod
64 #pod An array of recipe names that this recipe depends on.
65 #pod
66 #pod =cut
67  
68 7 ▶has requires => ( is => 'ro', default => sub { [] } );
Subroutine __ANON__: called CC=1 SCAR=0.0
69  
70 #pod =attr cache
71 #pod
72 #pod A L<Beam::Make::Cache> object. This is used to store content hashes and
73 #pod modified dates for later use.
74 #pod
75 #pod =cut
76  
77 11 has cache => ( is => 'ro', required => 1 );
78  
79 #pod =method fill_env
80 #pod
81 #pod Fill in any environment variables in the given array of strings. Environment variables
82 #pod are interpreted as a POSIX shell: C<< $name >> or C<< ${name} >>.
83 #pod
84 #pod =cut
85  
86 1 ▶sub fill_env( $self, @ary ) {
Subroutine fill_env: called CC=4 SCAR=22.5
Pod documented
87 return map {
88 1 ▶ defined $_ ?
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 3 0 3
89 0 ▶ s{\$\{([^\}]+\})}{ $ENV{ $1 } // ( "\$$1" ) }egr
Condition0%0/2
$ENV{$1} // "\$$1"
l!l
00
MC/DC0%0/1
$ENV{$1} // "\$$1"
$ENV{$1}
Truth table0%0/2
A
A= $ENV{$1}
Aresult
11
00
90 0 ▶ =~ s{\$([a-zA-Z_][a-zA-Z0-9_]+)}{ $ENV{ $1 } // ( "\$$1" ) }egr
Condition0%0/2
$ENV{$1} // "\$$1"
l!l
00
MC/DC0%0/1
$ENV{$1} // "\$$1"
$ENV{$1}
Truth table0%0/2
A
A= $ENV{$1}
Aresult
11
00
91 : $_
92 } @ary;
93 }
94  
95 11 1;
96  
97 __END__
« Make/Docker/Image.pm ↑ Summary Make/DBI/Schema.pm »