lib/Dancer/Hook/Properties.pm

filter: Statementstmt 78.5% 22 / 28 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 70.4% 31 / 44 CC 5 SCAR 12.1
CC
5
Cov
67%
should_run_this_app
5.3
_init_apps
4.5
BEGIN
1.0
CRAP 3.4
« lib/Dancer/Hook.pm ↑ Summary lib/Dancer/Config/Object.pm »
1 package Dancer::Hook::Properties;
2 179 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: Properties attached to a hook
4 179 $Dancer::Hook::Properties::VERSION = '1.3522';
5 179 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 179 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 179 ▶use base 'Dancer::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 179 Dancer::Hook::Properties->attributes(qw/apps/);
11  
12 134 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
13 134 my ($self, %args) = @_;
14  
15 134 $self->_init_apps(\%args);
16 134 return $self;
17 }
18  
19 134 ▶sub _init_apps {
Subroutine _init_apps: called CC=3 SCAR=15.1
20 134 my ( $self, $args ) = @_;
21 134 ▶ if ( my $apps = $args->{'apps'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $apps = $args->{'apps'}) { } 0 134 134
22 0 ▶ ref $apps ? $self->apps($apps) : $self->apps( [$apps] );
Branch: 1 branch
BranchTrueFalseTotal
ref $apps ? : 0 0 0
23 0 return;
24 }
25 else {
26 134 $self->apps( [] );
27 }
28 }
29  
30 298 ▶sub should_run_this_app {
Subroutine should_run_this_app: called CC=3 SCAR=16.7
Pod undocumented
31 298 my ( $self, $app ) = @_;
32  
33 298 ▶ return 1 unless scalar( @{ $self->apps } );
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->apps;} 298 0 298
34  
35 0 ▶ if ( $self->apps ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->apps) 0 0 0
36 0 return grep { $_ eq $app } @{ $self->apps };
37 }
38 }
39  
40 179 1;
41  
42 __END__
« lib/Dancer/Hook.pm ↑ Summary lib/Dancer/Config/Object.pm »