| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package # hidden from pause |
|
2
|
|
|
|
|
|
|
App::StaticImageGallery::Base::Source; |
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1610
|
use DateTime; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
61
|
|
|
5
|
2
|
|
|
2
|
|
35524
|
use Template; |
|
|
2
|
|
|
|
|
14867
|
|
|
|
2
|
|
|
|
|
72
|
|
|
6
|
2
|
|
|
2
|
|
25
|
use File::Basename (); |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
40
|
|
|
7
|
2
|
|
|
2
|
|
13
|
use parent 'App::StaticImageGallery::Base::NeedDir'; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _build_tt { |
|
10
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
11
|
0
|
|
|
|
|
|
my $tt_args = shift; |
|
12
|
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
$self->{_TT} = Template->new({ |
|
14
|
|
|
|
|
|
|
# INCLUDE_PATH => '', # or list ref |
|
15
|
|
|
|
|
|
|
INTERPOLATE => 1, # expand "$var" in plain text |
|
16
|
|
|
|
|
|
|
POST_CHOMP => 1, # cleanup whitespace |
|
17
|
|
|
|
|
|
|
# PRE_PROCESS => 'header', # prefix each template |
|
18
|
|
|
|
|
|
|
EVAL_PERL => 0, # evaluate Perl code blocks |
|
19
|
|
|
|
|
|
|
%$tt_args, |
|
20
|
|
|
|
|
|
|
}); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
1
|
|
sub TT { return shift->{_TT} }; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
|
sub write_style_files { die "write_style_files must be implemented in " . ref(shift) } |
|
26
|
0
|
|
|
0
|
1
|
|
sub template_config { die "template_config must be implemented in " . ref(shift) } |
|
27
|
0
|
|
|
0
|
1
|
|
sub image_page_template_name { die "image_page_template_name must be implemented in " . ref(shift) } |
|
28
|
0
|
|
|
0
|
1
|
|
sub index_page_template_name { die "index_page_template_name must be implemented in " . ref(shift) } |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub stash { |
|
31
|
0
|
|
|
0
|
1
|
|
my ( $self, $stash ) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
$stash->{now} = DateTime->now() |
|
34
|
|
|
|
|
|
|
unless ( defined $stash->{now} ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$stash->{version} = $App::StaticImageGallery::VERSION |
|
37
|
|
|
|
|
|
|
unless ( defined $stash->{version} ); |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
$stash->{work_dir} = File::Basename::basename($self->work_dir) |
|
40
|
|
|
|
|
|
|
unless ( defined $stash->{work_dir} ); |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
$stash->{sig} = $self |
|
43
|
|
|
|
|
|
|
unless ( defined $stash->{sig} ); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return $stash; |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub write_image_page { |
|
50
|
0
|
|
|
0
|
1
|
|
my ( $self,$size,$previous,$current,$next ) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $image_filename = $self->data_dir . '/' . $current->original . '.' . $size . '.html'; |
|
53
|
0
|
|
|
|
|
|
$self->msg_verbose(3,"Write image html: %s",$image_filename); |
|
54
|
|
|
|
|
|
|
# TODO |
|
55
|
|
|
|
|
|
|
# if ( $self->tt_class->template_config('write_image_html') ){ |
|
56
|
0
|
0
|
|
|
|
|
unless ($self->TT->process( $self->image_page_template_name(), $self->stash({ |
|
57
|
|
|
|
|
|
|
previous => $previous, |
|
58
|
|
|
|
|
|
|
current => $current, |
|
59
|
|
|
|
|
|
|
next => $next, |
|
60
|
|
|
|
|
|
|
size => $size, |
|
61
|
|
|
|
|
|
|
}), $image_filename )){ |
|
62
|
0
|
|
|
|
|
|
$self->msg("Can't write image html for image %s.\n\tTT-error: %s", |
|
63
|
|
|
|
|
|
|
$image_filename,$self->TT->error()); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
# } |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub write_index_page { |
|
69
|
0
|
|
|
0
|
1
|
|
my ( $self,$images,$dirs,$stash ) = @_; |
|
70
|
0
|
|
0
|
|
|
|
$stash ||= {}; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $index_filename = $self->work_dir . '/index.html'; |
|
73
|
0
|
|
|
|
|
|
$self->msg_verbose(3,"Write index.html: %s",$index_filename); |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
unless($self->TT->process( $self->index_page_template_name(),$self->stash({ |
|
76
|
|
|
|
|
|
|
images => $images, |
|
77
|
|
|
|
|
|
|
dirs => $dirs, |
|
78
|
|
|
|
|
|
|
%$stash, |
|
79
|
|
|
|
|
|
|
}), $index_filename )){ |
|
80
|
0
|
|
|
|
|
|
$self->msg("Can't write index.html: %s.\n\tTT-error: %s", |
|
81
|
|
|
|
|
|
|
$index_filename,$self->TT->error()); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
|
86
|
|
|
|
|
|
|
__END__ |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
App::StaticImageGallery::Base::Source |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 VERSION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
version 0.002 |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 METHODS |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 TT |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 image_page_template_name |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 index_page_template_name |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 stash |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 template_config |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 write_image_page |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 write_index_page |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 write_style_files |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 AUTHOR |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
See L<App::StaticImageGallery/AUTHOR> and L<App::StaticImageGallery/CONTRIBUTORS>. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |