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