| 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
| |||||||||||
| 22 | 0 | ▶ | ref $apps ? $self->apps($apps) : $self->apps( [$apps] ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | if ( $self->apps ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | return grep { $_ eq $app } @{ $self->apps }; | |||||||||
| 37 | } | ||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 172 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||