Stepford/Role/Step.pm

filter: Statementstmt 92.9% 53 / 57 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.2% 15 / 17 Podpod 100% 5 / 5 totaltotal 91.3% 74 / 81 CC 2 SCAR 2.0
CC
2
Cov
92%
__ANON__
2.0
has_production
2.0
__ANON__
2.0
CRAP 1.2
« Stepford/Role/Step/FileGenerator.pm ↑ Summary Stepford/Types/Internal.pm »
1 package Stepford::Role::Step;
2  
3 43 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 43 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 43 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 43 our $VERSION = '0.006001';
8  
9 43 ▶use List::AllUtils qw( any );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 43 ▶use Stepford::LoggerWithMoniker;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 43 ▶use Stepford::Trait::StepDependency;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 43 ▶use Stepford::Trait::StepProduction;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 43 ▶use Stepford::Types qw( Logger );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 43 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 43 requires qw( run last_run_time );
18  
19 43 has logger => (
20 is => 'ro',
21 isa => Logger,
22 required => 1,
23 );
24  
25 632 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
26 632 my $orig = shift;
27 632 my $class = shift;
28  
29 632 my $args = $class->$orig(@_);
30  
31 632 ▶ if ( $args->{logger} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"logger"}) 632 0 632
32 $args->{logger} = Stepford::LoggerWithMoniker->new(
33 logger => $args->{logger},
34 632 moniker => $class->_log_moniker,
35 );
36 }
37  
38 632 return $args;
39 43 };
40  
41 632 ▶sub _log_moniker {
Subroutine _log_moniker: called CC=1 SCAR=0.0
42 632 my $class = shift;
43 632 return $class;
44 }
45  
46 # Some of these should be moved into a metaclass extension
47 1997 ▶sub productions {
Subroutine productions: called CC=1 SCAR=0.0
Pod documented
48 1997 my $class = shift;
49  
50 return
51 1997 grep { $_->does('Stepford::Trait::StepProduction') }
52 $class->meta->get_all_attributes;
53 }
54  
55 0 ▶sub has_production {
Subroutine has_production: not called CC=1 SCAR=6.9
Pod documented
56 0 my $class = shift;
57 0 my $name = shift;
58  
59 0 ▶ return any { $_->name eq $name } $class->productions;
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 }
61  
62 382 ▶sub productions_as_hashref {
Subroutine productions_as_hashref: called CC=1 SCAR=0.0
Pod documented
63 382 my $self = shift;
64  
65 382 return { map { $_->name => $self->production_value( $_->name ) }
66 $self->productions };
67 }
68  
69 460 ▶sub production_value {
Subroutine production_value: called CC=1 SCAR=0.0
Pod documented
70 460 my $self = shift;
71 460 my $name = shift;
72  
73 460 my $reader = $self->meta->find_attribute_by_name($name)->get_read_method;
74 460 return $self->$reader;
75 }
76  
77 1186 ▶sub dependencies {
Subroutine dependencies: called CC=1 SCAR=0.0
Pod documented
78 1186 my $class = shift;
79  
80 return
81 1186 grep { $_->does('Stepford::Trait::StepDependency') }
82 $class->meta->get_all_attributes;
83 }
84  
85 43 1;
86  
87 # ABSTRACT: The basic role all step classes must implement
88  
89 __END__
« Stepford/Role/Step/FileGenerator.pm ↑ Summary Stepford/Types/Internal.pm »