blib/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
« blib/lib/Dancer/Hook.pm ↑ Summary blib/lib/Dancer/Config/Object.pm »
1 package Dancer::Hook::Properties;
2 170 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: Properties attached to a hook
4 170 $Dancer::Hook::Properties::VERSION = '1.3513';
5 170 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 170 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 170 ▶use base 'Dancer::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 170 Dancer::Hook::Properties->attributes(qw/apps/);
11  
12 sub init {
13 128 ▶ my ($self, %args) = @_;
Subroutine init: called CC=1 SCAR=0.0
Pod documented
14  
15 128 $self->_init_apps(\%args);
16 128 return $self;
17 }
18  
19 sub _init_apps {
20 128 ▶ my ( $self, $args ) = @_;
Subroutine _init_apps: called CC=3 SCAR=15.1
21 128 ▶ if ( my $apps = $args->{'apps'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $apps = $args->{'apps'}) { } 0 128 128
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 128 $self->apps( [] );
27 }
28 }
29  
30 sub should_run_this_app {
31 291 ▶ my ( $self, $app ) = @_;
Subroutine should_run_this_app: called CC=3 SCAR=16.7
Pod undocumented
32  
33 291 ▶ return 1 unless scalar( @{ $self->apps } );
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->apps;} 291 0 291
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 170 1;
41  
42 __END__
« blib/lib/Dancer/Hook.pm ↑ Summary blib/lib/Dancer/Config/Object.pm »