| 1 | package Image::Select::Array; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Pragmas. | ||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use base qw(Image::Select); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # Modules. | ||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Class::Utils qw(set_params); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Error::Pure qw(err); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # Version. | ||||||||||||||||||||||||||||
| 13 | 2 | our $VERSION = 0.04; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub new { | ||||||||||||||||||||||||||||
| 16 | 0 | ▶ | my ($class, @params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # Create object. | ||||||||||||||||||||||||||||
| 19 | 0 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # Debug. | ||||||||||||||||||||||||||||
| 22 | 0 | $self->{'debug'} = 0; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | # Loop. | ||||||||||||||||||||||||||||
| 25 | 0 | $self->{'loop'} = 0; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # Image list. | ||||||||||||||||||||||||||||
| 28 | 0 | $self->{'image_list'} = []; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # Image type. | ||||||||||||||||||||||||||||
| 31 | 0 | $self->{'type'} = 'bmp'; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Sizes. | ||||||||||||||||||||||||||||
| 34 | 0 | $self->{'height'} = 1080; | |||||||||||||||||||||||||||
| 35 | 0 | $self->{'width'} = 1920; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # Process params. | ||||||||||||||||||||||||||||
| 38 | 0 | set_params($self, @params); | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # Check type. | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if (defined $self->{'type'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 0 | $self->_check_type($self->{'type'}); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | # Check images array. | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if (! defined $self->{'image_list'} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $self->{"image_list"} or ref $self->{"image_list"} ne "ARRAY"
MC/DC0%0/2
not defined $self->{"image_list"} or ref $self->{"image_list"} ne "ARRAY"
not defined $self->{"image_list"}
ref $self->{"image_list"} ne "ARRAY"
Truth table0%0/3
not(A) or B
A= not defined $self->{"image_list"}B= ref $self->{"image_list"} ne "ARRAY"
| |||||||||||||||||||||||||||||
| 47 | || ref $self->{'image_list'} ne 'ARRAY') { | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | err "Parameter 'image_list' must be reference to array ". | |||||||||||||||||||||||||||
| 50 | 'with images.'; | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | # Check images. | ||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if (! @{$self->{'image_list'}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | err 'No images.'; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # Check images path. | ||||||||||||||||||||||||||||
| 59 | 0 | foreach my $image (@{$self->{'image_list'}}) { | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (! -r $image) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | err "Image '$image' doesn't readable."; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # Images to select. | ||||||||||||||||||||||||||||
| 66 | 0 | $self->{'_images_to_select'} = $self->{'image_list'}; | |||||||||||||||||||||||||||
| 67 | 0 | $self->{'_images_index'} = 0; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | # Object. | ||||||||||||||||||||||||||||
| 70 | 0 | return $self; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 2 | 1; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | __END__ | ||||||||||||||||||||||||||||