lib/Video/PlaybackMachine/FillSegment.pm

filter: Statementstmt 72.9% 27 / 37 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 0.0% 0 / 4 totaltotal 62.9% 34 / 54 CC 3 SCAR 6.3
CC
3
Cov
71%
is_available
3.1
get_priority
2.0
get_sequence
2.0
CRAP 1.9
« script/show_conflicts.pl ↑ Summary lib/Video/PlaybackMachine/Schema/Result/Schedule.pm »
1 package Video::PlaybackMachine::FillSegment;
2  
3 3 our $VERSION = '0.09'; # VERSION
4  
5 ####
6 #### Video::PlaybackMachine::FillSegment
7 ####
8 #### $Revision$
9 ####
10 #### The Filler fills up time in the schedule using an ordered set of
11 #### FillSegments. For example, an average break sequence might
12 #### consist of a 'Start Identification' segment played at the
13 #### beginning, followed by 'Announcements', followed by 'Short
14 #### Subject', followed by 'End Identification'.
15 ####
16  
17 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 ############################# Attributes #############################
22  
23 3 has 'name' => ( is => 'ro' );
24  
25 3 has 'sequence_order' => ( 'is' => 'ro' );
26  
27 3 has 'priority_order' => ( 'is' => 'ro' );
28  
29 3 has 'producer' => ( 'is' => 'ro', 'required' => 1 );
30  
31 ############################## Class Methods ##############################
32  
33  
34 ############################# Object Methods ##############################
35  
36 # Deprecate old get_ methods
37 {
38 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
39
40 3 foreach my $attr ( qw/name producer/ ) {
41 6 ▶ *{__PACKAGE__ . '::get_' . $attr} = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
42 0 carp "Using get_${attr}() deprecated";
43 0 return $_[0]->$attr;
44 6 };
45 }
46 }
47  
48  
49 ##
50 ## is_available()
51 ##
52 ## Arguments:
53 ## TIME_LEFT: int
54 ##
55 ## Returns:
56 ## boolean
57 ##
58 19 ▶sub is_available {
Subroutine is_available: called CC=3 SCAR=11.3
Pod undocumented
59 19 my $self = shift;
60 19 my ($time_left) = @_;
61 19 ▶ defined $time_left or confess('Argument $time_left required');
Branch: 1 branch
BranchTrueFalseTotal
defined $time_left or confess("Argument \$time_left required") 19 0 19
62  
63 19 ▶ $self->producer()->is_available() or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->producer->is_available or return 19 0 19
64  
65 19 return ($self->producer->time_layout()->min_time() <= $time_left);
66 }
67  
68  
69 ##
70 ## get_priority()
71 ##
72 ## Returns the priority order of the segment.
73 ##
74 0 ▶sub get_priority {
Subroutine get_priority: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my $self = shift;
76 0 carp "get_priority() deprecated; use priority_order() instead";
77 0 return $self->priority_order();
78 }
79  
80 ##
81 ## get_sequence()
82 ##
83 ## Returns the sequence order of the segment.
84 ##
85 0 ▶sub get_sequence {
Subroutine get_sequence: not called CC=1 SCAR=6.9
Pod undocumented
86 0 my $self = shift;
87 0 carp "get_sequence() deprecated; use sequence_order() instead";
88 0 return $self->sequence_order();
89 }
90  
91  
92 ##
93 ## get_next()
94 ##
95 ## Returns the sequence number of the FillSegment
96 ## which should come after this one.
97 ##
98 0 ▶sub get_next {
Subroutine get_next: not called CC=1 SCAR=6.9
Pod undocumented
99 0 my $self = shift;
100 0 return $self->producer->get_next( $self->sequence_order() );
101 }
102  
103 3 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 3 1;
« script/show_conflicts.pl ↑ Summary lib/Video/PlaybackMachine/Schema/Result/Schedule.pm »