Processor/Store/File.pm

filter: Statementstmt 36.1% 13 / 36 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 26.9% 17 / 63 CC 7 SCAR 17.7
CC
7
Cov
27%
create_path
12.0
extension
6.0
get_image_list
6.0
CRAP 5.9
« Processor/Interface/Console.pm ↑ Summary Processor/Base.pm »
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
BranchTrueFalseTotal
unless -d $dir 0 0 0
14 0 my $print_dirs = 0;
15 0 my $perms = 0777;
16 0 ▶ mkpath( "$dir", $print_dirs, $perms )
Branch: 1 branch
BranchTrueFalseTotal
mkpath("$dir", $print_dirs, $perms) or return "Can't create directory '${dir}': $!" 0 0 0
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
BranchTrueFalseTotal
unless $set 0 0 0
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'
l!l
00
MC/DC0%0/1
$self->extension || 'jpg|gif'
$self->extension
Truth table0%0/2
A
A= $self->extension
Aresult
11
00
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
BranchTrueFalseTotal
unless $set 0 0 0
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
BranchTrueFalseTotal
if $self->cdrom 0 0 0
50
51
52 0 $self->source_directory($source_dir);
53 }
54
55
56 1 1;
57
58 __END__
« Processor/Interface/Console.pm ↑ Summary Processor/Base.pm »