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 SCAR 17.8
CC
5
Cov
67%
should_run_this_app
5.3
_init_apps
4.5
BEGIN
1.0
CRAP 5.9
« blib/lib/Dancer/Request/Upload.pm ↑ Summary blib/lib/Dancer/GetOpt.pm »
1 package Dancer::Hook::Properties;
2 172 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: Properties attached to a hook
4 172 $Dancer::Hook::Properties::VERSION = '1.3520';
5 172 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 172 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 172 ▶use base 'Dancer::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 172 Dancer::Hook::Properties->attributes(qw/apps/);
11  
12 sub init {
13 134 ▶ my ($self, %args) = @_;
Subroutine init: called CC=1 SCAR=0.0
Pod documented
14  
15 134 $self->_init_apps(\%args);
16 134 return $self;
17 }
18  
19 sub _init_apps {
20 134 ▶ my ( $self, $args ) = @_;
Subroutine _init_apps: called CC=3 SCAR=15.1
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 sub should_run_this_app {
31 298 ▶ my ( $self, $app ) = @_;
Subroutine should_run_this_app: called CC=3 SCAR=16.7
Pod undocumented
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 172 1;
41  
42 __END__
« blib/lib/Dancer/Request/Upload.pm ↑ Summary blib/lib/Dancer/GetOpt.pm »