| 1 | package Image::Processor::Store::File; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use base ( 'Image::Processor::Base' ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 1 | ▶ | use File::Path; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | ▶ | use File::Copy; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | # handles all the File interaction | ||||||||||||
| 10 | |||||||||||||
| 11 | 0 | ▶ | sub create_path { | ||||||||||
|
Subroutine
create_path: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 12 | 0 | my ($self,$dir) = @_; | |||||||||||
| 13 | 0 | ▶ | print "Creating dir '$dir'\n\n" if (!-d $dir); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 0 | my $print_dirs = 0; | |||||||||||
| 15 | 0 | my $perms = 0777; | |||||||||||
| 16 | 0 | ▶ | mkpath( "$dir", $print_dirs, $perms ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | or return "Can't create directory '$dir': $!"; | ||||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 0 | ▶ | sub extension { | ||||||||||
|
Subroutine
extension: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 21 | 0 | my ($self,$set) = @_; | |||||||||||
| 22 | 0 | ▶ | return $self->{'extension'} if !$set; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | 0 | $self->{'extension'} = $set; | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | 0 | ▶ | sub get_image_list { | ||||||||||
|
Subroutine
get_image_list: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 27 | 0 | my ($self,$set) = @_; | |||||||||||
| 28 | 0 | chdir($self->source_directory()); | |||||||||||
| 29 | 0 | ▶ | my $expression = $self->extension() || "jpg|gif"; | ||||||||||
|
Condition0%0/2
$self->extension || 'jpg|gif'
MC/DC0%0/1
$self->extension || 'jpg|gif'
$self->extension
Truth table0%0/2
A
A= $self->extension
| |||||||||||||
| 30 | # get list of picture | ||||||||||||
| 31 | 0 | opendir(DIR, $self->source_directory()); | |||||||||||
| 32 | 0 | my @files; | |||||||||||
| 33 | 0 | @files = grep { /\.($expression)$/i } readdir(DIR); | |||||||||||
| 34 | |||||||||||||
| 35 | 0 | closedir(DIR); | |||||||||||
| 36 | 0 | $self->image_list(\@files); | |||||||||||
| 37 | # $self->image_list([ <*.jpg> ]); | ||||||||||||
| 38 | |||||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 0 | ▶ | sub image_list { | ||||||||||
|
Subroutine
image_list: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 42 | 0 | my ($self,$set) = @_; | |||||||||||
| 43 | 0 | ▶ | return $self->{'image_list'} if !$set; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | $self->{'image_list'} = $set; | |||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 0 | ▶ | sub determine_source { | ||||||||||
|
Subroutine
determine_source: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 48 | 0 | my ($self) = @_; | |||||||||||
| 49 | 0 | ▶ | my $source_dir = $self->cdrom() . "/PICTURES" if $self->cdrom(); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 50 | |||||||||||||
| 51 | |||||||||||||
| 52 | 0 | $self->source_directory($source_dir); | |||||||||||
| 53 | } | ||||||||||||
| 54 | |||||||||||||
| 55 | |||||||||||||
| 56 | 1 | 1; | |||||||||||
| 57 | |||||||||||||
| 58 | __END__ | ||||||||||||