| 1 | package Video::Delay::Array; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Pragmas. | ||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # Modules. | ||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Class::Utils qw(set_params); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # Version. | ||||||||||||||||||||||||||||
| 11 | 4 | our $VERSION = 0.06; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # Constructor. | ||||||||||||||||||||||||||||
| 14 | sub new { | ||||||||||||||||||||||||||||
| 15 | 5 | ▶ | my ($class, @params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | # Create object. | ||||||||||||||||||||||||||||
| 18 | 5 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # Array. | ||||||||||||||||||||||||||||
| 21 | 5 | $self->{'array'} = [1000, 2000, 3000]; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | # Loop. | ||||||||||||||||||||||||||||
| 24 | 5 | $self->{'loop'} = 1; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # Process params. | ||||||||||||||||||||||||||||
| 27 | 5 | set_params($self, @params); | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # Index. | ||||||||||||||||||||||||||||
| 30 | 3 | $self->{'index'} = 0; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | # Object. | ||||||||||||||||||||||||||||
| 33 | 3 | return $self; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | # Get delay. | ||||||||||||||||||||||||||||
| 37 | sub delay { | ||||||||||||||||||||||||||||
| 38 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
delay: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # Return value. | ||||||||||||||||||||||||||||
| 41 | 6 | my $ret; | |||||||||||||||||||||||||||
| 42 | 6 | ▶ | if ($self->{'index'} <= @{$self->{'array'}} - 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 5 | $ret = $self->{'array'}->[$self->{'index'}]; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # Increment. | ||||||||||||||||||||||||||||
| 47 | 6 | $self->{'index'}++; | |||||||||||||||||||||||||||
| 48 | 6 | ▶ | if ($self->{'loop'} && $self->{'index'} > @{$self->{'array'}} - 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"loop"} and $self->{"index"} > @{$self->{"array"};} - 1
MC/DC100%2/2
$self->{"loop"} and $self->{"index"} > @{$self->{"array"};} - 1
$self->{"loop"}
$self->{"index"} > @{$self->{"array"};} - 1
Truth table100%3/3
A and B
A= $self->{"loop"}B= $self->{"index"} > @{$self->{"array"};} - 1
| |||||||||||||||||||||||||||||
| 49 | 1 | $self->{'index'} = 0; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | # Value. | ||||||||||||||||||||||||||||
| 53 | 6 | return $ret; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 4 | 1; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||