| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package VLGal::File; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
16
|
use 5.006; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
33
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
27
|
|
|
5
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
26
|
|
|
6
|
1
|
|
|
1
|
|
815
|
use Error qw(:try); |
|
|
1
|
|
|
|
|
6437
|
|
|
|
1
|
|
|
|
|
5
|
|
|
7
|
1
|
|
|
1
|
|
231
|
use File::Basename; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
96
|
|
|
8
|
1
|
|
|
1
|
|
655
|
use VLGal::Style; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2888
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Used by _value_is_allowed |
|
11
|
|
|
|
|
|
|
our %ALLOW_ISA = ( |
|
12
|
|
|
|
|
|
|
'super_dir' => [ 'VLGal::Directory' ], |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Used by _value_is_allowed |
|
16
|
|
|
|
|
|
|
our %ALLOW_REF = ( |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Used by _value_is_allowed |
|
20
|
|
|
|
|
|
|
our %ALLOW_RX = ( |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Used by _value_is_allowed |
|
24
|
|
|
|
|
|
|
our %ALLOW_VALUE = ( |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Package version |
|
28
|
|
|
|
|
|
|
our ($VERSION) = '$Revision: 0.01 $' =~ /\$Revision:\s+([^\s]+)/; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
VLGal::File - Vincenzo's little gallery file |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
None. This is an abstract class. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 ABSTRACT |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Vincenzo's little gallery file |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
C is an abstract class that describes generic properties of Vincenzo's little gallery file. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=over |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item new( [ OPT_HASH_REF ] ) |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Creates a new C object. C is a hash reference used to pass initialization options. On error an exception C is thrown. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Options for C may include: |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B> |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Passed to L. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item B> |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Passed to L. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item B> |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Passed to L. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 METHODS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item get_basename() |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns the file's base name. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item get_dirname() |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Returns the file's directory name. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item get_super_dir() |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Returns the super directory in the file system. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item mk_fs_name() |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Makes the file systemn name of the object usinf C and C. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item mk_vlgal_dir_name() |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Makes the name of the C<.vlgal> directory. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item set_basename(VALUE) |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Set the file's base name. C is the value. On error an exception C is thrown. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item set_dirname(VALUE) |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Set the file's directory name. C is the value. On error an exception C is thrown. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item set_super_dir(VALUE) |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Set the super directory in the file system. C is the value. On error an exception C is thrown. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item VALUE must be a (sub)class of: |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=over |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item VLGal::Directory |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=back |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L, |
|
127
|
|
|
|
|
|
|
L, |
|
128
|
|
|
|
|
|
|
L, |
|
129
|
|
|
|
|
|
|
L, |
|
130
|
|
|
|
|
|
|
L |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 BUGS |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
None known (yet.) |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 HISTORY |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
First development: September 2003 |
|
139
|
|
|
|
|
|
|
Last update: October 2003 |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 AUTHOR |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Vincenzo Zocca |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Copyright 2003 by Vincenzo Zocca |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 LICENSE |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This file is part of the C module hierarchy for Perl by |
|
152
|
|
|
|
|
|
|
Vincenzo Zocca. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
The VLGal module hierarchy is free software; you can redistribute it |
|
155
|
|
|
|
|
|
|
and/or modify it under the terms of the GNU General Public License |
|
156
|
|
|
|
|
|
|
as published by the Free Software Foundation; either version 2 of |
|
157
|
|
|
|
|
|
|
the License, or (at your option) any later version. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
The VLGal module hierarchy is distributed in the hope that it will |
|
160
|
|
|
|
|
|
|
be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
161
|
|
|
|
|
|
|
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
162
|
|
|
|
|
|
|
See the GNU General Public License for more details. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
165
|
|
|
|
|
|
|
along with the VLGal module hierarchy; if not, write to |
|
166
|
|
|
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
|
167
|
|
|
|
|
|
|
Boston, MA 02111-1307 USA |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub new { |
|
172
|
2
|
|
|
2
|
1
|
2
|
my $class = shift; |
|
173
|
|
|
|
|
|
|
|
|
174
|
2
|
|
|
|
|
3
|
my $self = {}; |
|
175
|
2
|
|
33
|
|
|
10
|
bless( $self, ( ref($class) || $class ) ); |
|
176
|
2
|
|
|
|
|
8
|
return( $self->_initialize(@_) ); |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub _initialize { |
|
180
|
2
|
|
|
2
|
|
3
|
my $self = shift; |
|
181
|
2
|
50
|
|
|
|
4
|
my $opt = defined($_[0]) ? shift : {}; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# Check $opt |
|
184
|
2
|
50
|
|
|
|
7
|
ref($opt) eq 'HASH' || throw Error::Simple("ERROR: VLGal::File::_initialize, first argument must be 'HASH' reference."); |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
# basename, SINGLE |
|
187
|
2
|
50
|
|
|
|
12
|
exists( $opt->{basename} ) && $self->set_basename( $opt->{basename} ); |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# dirname, SINGLE |
|
190
|
2
|
50
|
|
|
|
18
|
exists( $opt->{dirname} ) && $self->set_dirname( $opt->{dirname} ); |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# super_dir, SINGLE |
|
193
|
2
|
50
|
|
|
|
5
|
exists( $opt->{super_dir} ) && $self->set_super_dir( $opt->{super_dir} ); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
# Return $self |
|
196
|
2
|
|
|
|
|
14
|
return($self); |
|
197
|
|
|
|
|
|
|
} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub _value_is_allowed { |
|
200
|
5
|
|
|
5
|
|
5
|
my $name = shift; |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# Value is allowed if no ALLOW clauses exist for the named attribute |
|
203
|
5
|
50
|
66
|
|
|
66
|
if ( ! exists( $ALLOW_ISA{$name} ) && ! exists( $ALLOW_REF{$name} ) && ! exists( $ALLOW_RX{$name} ) && ! exists( $ALLOW_VALUE{$name} ) ) { |
|
|
|
|
33
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
204
|
4
|
|
|
|
|
17
|
return(1); |
|
205
|
|
|
|
|
|
|
} |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
# At this point, all values in @_ must to be allowed |
|
208
|
|
|
|
|
|
|
CHECK_VALUES: |
|
209
|
1
|
|
|
|
|
3
|
foreach my $val (@_) { |
|
210
|
|
|
|
|
|
|
# Check ALLOW_ISA |
|
211
|
1
|
50
|
33
|
|
|
15
|
if ( ref($val) && exists( $ALLOW_ISA{$name} ) ) { |
|
212
|
1
|
|
|
|
|
2
|
foreach my $class ( @{ $ALLOW_ISA{$name} } ) { |
|
|
1
|
|
|
|
|
4
|
|
|
213
|
1
|
50
|
|
|
|
7
|
&UNIVERSAL::isa( $val, $class ) && next CHECK_VALUES; |
|
214
|
|
|
|
|
|
|
} |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# Check ALLOW_REF |
|
218
|
0
|
0
|
0
|
|
|
0
|
if ( ref($val) && exists( $ALLOW_REF{$name} ) ) { |
|
219
|
0
|
0
|
|
|
|
0
|
exists( $ALLOW_REF{$name}{ ref($val) } ) && next CHECK_VALUES; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
# Check ALLOW_RX |
|
223
|
0
|
0
|
0
|
|
|
0
|
if ( defined($val) && ! ref($val) && exists( $ALLOW_RX{$name} ) ) { |
|
|
|
|
0
|
|
|
|
|
|
224
|
0
|
|
|
|
|
0
|
foreach my $rx ( @{ $ALLOW_RX{$name} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
225
|
0
|
0
|
|
|
|
0
|
$val =~ /$rx/ && next CHECK_VALUES; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# Check ALLOW_VALUE |
|
230
|
0
|
0
|
0
|
|
|
0
|
if ( ! ref($val) && exists( $ALLOW_VALUE{$name} ) ) { |
|
231
|
0
|
0
|
|
|
|
0
|
exists( $ALLOW_VALUE{$name}{$val} ) && next CHECK_VALUES; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# We caught a not allowed value |
|
235
|
0
|
|
|
|
|
0
|
return(0); |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
# OK, all values are allowed |
|
239
|
1
|
|
|
|
|
4
|
return(1); |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub diff_html_dir { |
|
243
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
244
|
0
|
|
|
|
|
0
|
my $to_file = shift; |
|
245
|
|
|
|
|
|
|
|
|
246
|
0
|
0
|
|
|
|
0
|
$to_file || |
|
247
|
|
|
|
|
|
|
return(''); |
|
248
|
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
0
|
my @from_dir = (); |
|
250
|
0
|
|
|
|
|
0
|
my $runner = $self; |
|
251
|
0
|
|
|
|
|
0
|
while (my $super_dir = $runner->get_super_dir() ) { |
|
252
|
0
|
|
|
|
|
0
|
unshift( @from_dir, $super_dir ); |
|
253
|
0
|
|
|
|
|
0
|
$runner = $super_dir; |
|
254
|
|
|
|
|
|
|
} |
|
255
|
|
|
|
|
|
|
|
|
256
|
0
|
|
|
|
|
0
|
my @to_dir = (); |
|
257
|
0
|
|
|
|
|
0
|
$runner = $to_file; |
|
258
|
0
|
|
|
|
|
0
|
while (my $super_dir = $runner->get_super_dir() ) { |
|
259
|
0
|
|
|
|
|
0
|
unshift( @to_dir, $super_dir ); |
|
260
|
0
|
|
|
|
|
0
|
$runner = $super_dir; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
0
|
while (1) { |
|
264
|
0
|
0
|
0
|
|
|
0
|
scalar( @from_dir ) && scalar( @to_dir ) || |
|
265
|
|
|
|
|
|
|
last; |
|
266
|
0
|
0
|
|
|
|
0
|
( $from_dir[0] != $to_dir[0] ) && |
|
267
|
|
|
|
|
|
|
last; |
|
268
|
0
|
|
|
|
|
0
|
shift( @from_dir ); |
|
269
|
0
|
|
|
|
|
0
|
shift( @to_dir ); |
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
0
|
my $diff = '../' x scalar( @from_dir ); |
|
273
|
0
|
|
|
|
|
0
|
foreach my $file ( @to_dir ) { |
|
274
|
0
|
|
|
|
|
0
|
$diff .= $file->get_basename() . '/'; |
|
275
|
|
|
|
|
|
|
} |
|
276
|
0
|
|
|
|
|
0
|
return( $diff ); |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub generate { |
|
280
|
0
|
|
|
0
|
0
|
0
|
throw Error::Simple("ERROR: VLGal::File::generate, call this method in a subclass that has implemented it."); |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub generate_html { |
|
284
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
285
|
0
|
|
|
|
|
0
|
my $fn = shift; |
|
286
|
0
|
|
|
|
|
0
|
my $super_html_dir = shift; |
|
287
|
0
|
|
|
|
|
0
|
my $prev_file = shift; |
|
288
|
0
|
|
|
|
|
0
|
my $next_file = shift; |
|
289
|
0
|
|
|
|
|
0
|
my $size = shift; |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
# Make code easier to read with $style |
|
292
|
0
|
|
|
|
|
0
|
my $style = VLGal::Style->instance(); |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
# Print verbose message |
|
295
|
0
|
0
|
|
|
|
0
|
$style->is_verbose() && |
|
296
|
|
|
|
|
|
|
print STDERR "Making file '$fn'.\n"; |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
# Open the index-vlgal.html file |
|
299
|
0
|
|
|
|
|
0
|
my $fh = IO::File->new( $fn, 'w' ); |
|
300
|
0
|
0
|
|
|
|
0
|
defined($fh) || |
|
301
|
|
|
|
|
|
|
throw Error::Simple("ERROR: VLGal::File::generate_html, failed to open file '$fn' for writing."); |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
# Write the first part of the html header |
|
304
|
0
|
|
|
|
|
0
|
my $basename = $self->get_basename(); |
|
305
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
Gallery of $basename |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
| |
|
327
|
|
|
|
|
|
|
EOF |
|
328
|
|
|
|
|
|
|
|
|
329
|
0
|
|
|
|
|
0
|
$self->generate_td_cont_prev( $fh, $size ); |
|
330
|
|
|
|
|
|
|
|
|
331
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
| |
|
334
|
|
|
|
|
|
|
EOF |
|
335
|
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
0
|
$self->generate_td_cont_next( $fh, $size ); |
|
337
|
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
| |
|
341
|
|
|
|
|
|
|
EOF |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
# Write super directory access line |
|
344
|
0
|
|
|
|
|
0
|
my @super = (); |
|
345
|
0
|
|
|
|
|
0
|
my $runner = $self; |
|
346
|
0
|
|
|
|
|
0
|
while ( my $super = $runner->get_super_dir() ) { |
|
347
|
0
|
|
|
|
|
0
|
push( @super, $super ); |
|
348
|
0
|
|
|
|
|
0
|
$runner = $super; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
351
|
|
|
|
|
|
|
Path: |
|
352
|
|
|
|
|
|
|
EOF |
|
353
|
0
|
|
|
|
|
0
|
for ( my $i = scalar( @super ) - 1; $i >= 0; $i-- ) { |
|
354
|
0
|
|
|
|
|
0
|
my $super_base = $super[$i]->get_basename(); |
|
355
|
0
|
|
|
|
|
0
|
my $super_dir = '../' x $i; |
|
356
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
357
|
|
|
|
|
|
|
$super_base / |
|
358
|
|
|
|
|
|
|
EOF |
|
359
|
|
|
|
|
|
|
} |
|
360
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
361
|
|
|
|
|
|
|
$basename |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
EOF |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
# Close navigation table |
|
366
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
| |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
EOF |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# Make the image |
|
373
|
0
|
|
|
|
|
0
|
my $img_dir = ''; |
|
374
|
0
|
0
|
0
|
|
|
0
|
if ( ! $size->get_max_height() || ! $size->get_max_width() ) { |
|
375
|
0
|
|
|
|
|
0
|
$img_dir = '../../'; |
|
376
|
|
|
|
|
|
|
} |
|
377
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
EOF |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
# Generate sizes |
|
383
|
0
|
|
|
|
|
0
|
$self->generate_size( |
|
384
|
|
|
|
|
|
|
$fh, |
|
385
|
|
|
|
|
|
|
$size, |
|
386
|
|
|
|
|
|
|
); |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
# Close html file |
|
389
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
EOF |
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub generate_size { |
|
396
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
397
|
0
|
|
|
|
|
0
|
my $fh = shift; |
|
398
|
0
|
|
|
|
|
0
|
my $skip_size = shift; |
|
399
|
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
401
|
|
|
|
|
|
|
Size: |
|
402
|
|
|
|
|
|
|
EOF |
|
403
|
|
|
|
|
|
|
|
|
404
|
0
|
|
|
|
|
0
|
my $i = -1; |
|
405
|
0
|
|
|
|
|
0
|
my $size_nr = scalar( VLGal::Style->instance()->get_size() ); |
|
406
|
0
|
|
|
|
|
0
|
foreach my $size ( VLGal::Style->instance()->get_size() ) { |
|
407
|
0
|
|
|
|
|
0
|
$i++; |
|
408
|
0
|
0
|
|
|
|
0
|
$i > 0 || |
|
409
|
|
|
|
|
|
|
next; |
|
410
|
|
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
0
|
my $label = $size->get_label(); |
|
412
|
0
|
|
|
|
|
0
|
my $size_base = $size->get_basename(); |
|
413
|
0
|
|
|
|
|
0
|
my $basename = $self->get_basename(); |
|
414
|
0
|
0
|
|
|
|
0
|
if ( $i == 1 ) { |
|
415
|
0
|
|
|
|
|
0
|
$label = "(default) $label"; |
|
416
|
|
|
|
|
|
|
} |
|
417
|
|
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
0
|
my $slash; |
|
419
|
0
|
0
|
|
|
|
0
|
if ( $i == $size_nr - 1 ) { |
|
420
|
0
|
|
|
|
|
0
|
$slash = ''; |
|
421
|
|
|
|
|
|
|
} |
|
422
|
|
|
|
|
|
|
else { |
|
423
|
0
|
|
|
|
|
0
|
$slash = ' /'; |
|
424
|
|
|
|
|
|
|
} |
|
425
|
|
|
|
|
|
|
|
|
426
|
0
|
0
|
|
|
|
0
|
if ( $skip_size == $size ) { |
|
427
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
428
|
|
|
|
|
|
|
$label${slash} |
|
429
|
|
|
|
|
|
|
EOF |
|
430
|
|
|
|
|
|
|
} |
|
431
|
|
|
|
|
|
|
else { |
|
432
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
433
|
|
|
|
|
|
|
$label ${slash} |
|
434
|
|
|
|
|
|
|
EOF |
|
435
|
|
|
|
|
|
|
} |
|
436
|
|
|
|
|
|
|
} |
|
437
|
|
|
|
|
|
|
} |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
sub generate_table_td { |
|
440
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
441
|
0
|
|
|
|
|
0
|
my $fh = shift; |
|
442
|
0
|
|
|
|
|
0
|
my $icon_dir = shift; |
|
443
|
0
|
|
|
|
|
0
|
my $href_tmpl = shift; |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
# Start table data |
|
446
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
447
|
|
|
|
|
|
|
| |
|
448
|
|
|
|
|
|
|
EOF |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
# Start anchor |
|
451
|
0
|
|
|
|
|
0
|
my $basename = $self->get_basename(); |
|
452
|
0
|
|
|
|
|
0
|
$href_tmpl =~ s/__BASENAME__/$basename/g; |
|
453
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
454
|
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
EOF |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
# Icon and text in anchor |
|
458
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
459
|
|
|
|
|
|
|
 |
|
460
|
|
|
|
|
|
|
$basename |
|
461
|
|
|
|
|
|
|
EOF |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
# Print basename |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
# End anchor |
|
466
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
EOF |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
# End table data |
|
471
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
EOF |
|
474
|
|
|
|
|
|
|
} |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
sub generate_td_cont_next { |
|
477
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
478
|
0
|
|
|
|
|
0
|
my $fh = shift; |
|
479
|
0
|
|
|
|
|
0
|
my $size = shift; |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
# Get next |
|
482
|
0
|
|
|
|
|
0
|
my $next_file = $self->get_next_in_hier(); |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
# Return if none |
|
485
|
0
|
0
|
|
|
|
0
|
$next_file || |
|
486
|
|
|
|
|
|
|
return(); |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
# Make code easier to read with $style |
|
489
|
0
|
|
|
|
|
0
|
my $style = VLGal::Style->instance(); |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
# Make the next path |
|
492
|
0
|
|
|
|
|
0
|
my $href = $self->diff_html_dir( $next_file ); |
|
493
|
0
|
|
|
|
|
0
|
my $icon; |
|
494
|
0
|
0
|
|
|
|
0
|
if ( $href ) { |
|
495
|
0
|
|
|
|
|
0
|
$href = '../../' . $href . '.vlgal/' . $size->get_basename() . '/' . $next_file->get_basename(); |
|
496
|
0
|
|
|
|
|
0
|
$icon = '../icon/' . basename( $style->get_image_icon_next_seq() ); |
|
497
|
|
|
|
|
|
|
} |
|
498
|
|
|
|
|
|
|
else { |
|
499
|
0
|
|
|
|
|
0
|
$href = $href . $next_file->get_basename(); |
|
500
|
0
|
|
|
|
|
0
|
$icon = '../icon/' . basename( $style->get_image_icon_next_peer() ); |
|
501
|
|
|
|
|
|
|
} |
|
502
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
EOF |
|
507
|
|
|
|
|
|
|
} |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
sub generate_td_cont_prev { |
|
510
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
511
|
0
|
|
|
|
|
0
|
my $fh = shift; |
|
512
|
0
|
|
|
|
|
0
|
my $size = shift; |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
# Get previous |
|
515
|
0
|
|
|
|
|
0
|
my $prev_file = $self->get_previous_in_hier(); |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
# Return if none |
|
518
|
0
|
0
|
|
|
|
0
|
$prev_file || |
|
519
|
|
|
|
|
|
|
return(); |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
# Make code easier to read with $style |
|
522
|
0
|
|
|
|
|
0
|
my $style = VLGal::Style->instance(); |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
# Make the previous path |
|
525
|
0
|
|
|
|
|
0
|
my $href = $self->diff_html_dir( $prev_file ); |
|
526
|
0
|
|
|
|
|
0
|
my $icon; |
|
527
|
0
|
0
|
|
|
|
0
|
if ( $href ) { |
|
528
|
0
|
|
|
|
|
0
|
$href = '../../' . $href . '.vlgal/' . $size->get_basename() . '/' . $prev_file->get_basename(); |
|
529
|
0
|
|
|
|
|
0
|
$icon = '../icon/' . basename( $style->get_image_icon_previous_seq() ); |
|
530
|
|
|
|
|
|
|
} |
|
531
|
|
|
|
|
|
|
else { |
|
532
|
0
|
|
|
|
|
0
|
$href = $href . $prev_file->get_basename(); |
|
533
|
0
|
|
|
|
|
0
|
$icon = '../icon/' . basename( $style->get_image_icon_previous_peer() ); |
|
534
|
|
|
|
|
|
|
} |
|
535
|
0
|
|
|
|
|
0
|
$fh->print(<
|
|
536
|
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
EOF |
|
540
|
|
|
|
|
|
|
} |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
sub get_basename { |
|
543
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
544
|
|
|
|
|
|
|
|
|
545
|
1
|
|
|
|
|
5
|
return( $self->{VLGal_File}{basename} ); |
|
546
|
|
|
|
|
|
|
} |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
sub get_dirname { |
|
549
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
550
|
|
|
|
|
|
|
|
|
551
|
0
|
|
|
|
|
0
|
return( $self->{VLGal_File}{dirname} ); |
|
552
|
|
|
|
|
|
|
} |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
sub get_next_in_hier { |
|
555
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
556
|
|
|
|
|
|
|
|
|
557
|
0
|
0
|
|
|
|
0
|
$self->get_super_dir() || |
|
558
|
|
|
|
|
|
|
return(undef); |
|
559
|
|
|
|
|
|
|
|
|
560
|
0
|
|
|
|
|
0
|
my $seq_hier = $self->get_root_dir()->get__all_file_(); |
|
561
|
0
|
|
|
|
|
0
|
my $i = $seq_hier->[1]{$self}; |
|
562
|
|
|
|
|
|
|
|
|
563
|
0
|
|
|
|
|
0
|
for ( my $j = $i + 1; $j < scalar( @{ $seq_hier->[0] } ); $j++ ) { |
|
|
0
|
|
|
|
|
0
|
|
|
564
|
0
|
0
|
|
|
|
0
|
if ( $self->isa( 'VLGal::Directory' ) ) { |
|
565
|
0
|
0
|
|
|
|
0
|
$seq_hier->[0][$j]->isa( 'VLGal::Directory' ) && |
|
566
|
|
|
|
|
|
|
return( $seq_hier->[0][$j] ); |
|
567
|
|
|
|
|
|
|
} |
|
568
|
|
|
|
|
|
|
else { |
|
569
|
0
|
0
|
|
|
|
0
|
$seq_hier->[0][$j]->isa( 'VLGal::Directory' ) || |
|
570
|
|
|
|
|
|
|
return( $seq_hier->[0][$j] ); |
|
571
|
|
|
|
|
|
|
} |
|
572
|
|
|
|
|
|
|
} |
|
573
|
|
|
|
|
|
|
} |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
sub get_previous_in_hier { |
|
576
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
577
|
|
|
|
|
|
|
|
|
578
|
0
|
0
|
|
|
|
0
|
$self->get_super_dir() || |
|
579
|
|
|
|
|
|
|
return(undef); |
|
580
|
|
|
|
|
|
|
|
|
581
|
0
|
|
|
|
|
0
|
my $seq_hier = $self->get_root_dir()->get__all_file_(); |
|
582
|
0
|
|
|
|
|
0
|
my $i = $seq_hier->[1]{$self}; |
|
583
|
|
|
|
|
|
|
|
|
584
|
0
|
|
|
|
|
0
|
for ( my $j = $i - 1; $j >= 0; $j-- ) { |
|
585
|
0
|
0
|
|
|
|
0
|
if ( $self->isa( 'VLGal::Directory' ) ) { |
|
586
|
0
|
0
|
|
|
|
0
|
$seq_hier->[0][$j]->isa( 'VLGal::Directory' ) && |
|
587
|
|
|
|
|
|
|
return( $seq_hier->[0][$j] ); |
|
588
|
|
|
|
|
|
|
} |
|
589
|
|
|
|
|
|
|
else { |
|
590
|
0
|
0
|
|
|
|
0
|
$seq_hier->[0][$j]->isa( 'VLGal::Directory' ) || |
|
591
|
|
|
|
|
|
|
return( $seq_hier->[0][$j] ); |
|
592
|
|
|
|
|
|
|
} |
|
593
|
|
|
|
|
|
|
} |
|
594
|
|
|
|
|
|
|
} |
|
595
|
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
sub get_root_dir { |
|
597
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
598
|
|
|
|
|
|
|
|
|
599
|
0
|
|
|
|
|
0
|
my $root = undef; |
|
600
|
0
|
0
|
|
|
|
0
|
$root = $self if ( $self->isa('VLGal::Directory') ); |
|
601
|
0
|
|
|
|
|
0
|
my $super = $self; |
|
602
|
0
|
|
|
|
|
0
|
while ( $super = $super->get_super_dir() ) { |
|
603
|
0
|
|
|
|
|
0
|
$root = $super; |
|
604
|
|
|
|
|
|
|
} |
|
605
|
0
|
|
|
|
|
0
|
return($root); |
|
606
|
|
|
|
|
|
|
} |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
sub get_super_dir { |
|
609
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
610
|
|
|
|
|
|
|
|
|
611
|
0
|
|
|
|
|
0
|
return( $self->{VLGal_File}{super_dir} ); |
|
612
|
|
|
|
|
|
|
} |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
sub mk_fs_name { |
|
615
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
616
|
|
|
|
|
|
|
|
|
617
|
0
|
|
|
|
|
0
|
return( File::Spec->catfile( $self->get_dirname(), $self->get_basename() ) ); |
|
618
|
|
|
|
|
|
|
} |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
sub mk_vlgal_dir_name { |
|
621
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
622
|
|
|
|
|
|
|
|
|
623
|
0
|
|
|
|
|
0
|
return( File::Spec->catfile( $self->get_dirname(), '.vlgal' ) ); |
|
624
|
|
|
|
|
|
|
} |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
sub set_basename { |
|
627
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
|
628
|
2
|
|
|
|
|
2
|
my $val = shift; |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
# Check if isa/ref/rx/value is allowed |
|
631
|
2
|
50
|
|
|
|
5
|
&_value_is_allowed( 'basename', $val ) || throw Error::Simple("ERROR: VLGal::File::set_basename, the specified value '$val' is not allowed."); |
|
632
|
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
# Assignment |
|
634
|
2
|
|
|
|
|
6
|
$self->{VLGal_File}{basename} = $val; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
sub set_dirname { |
|
638
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
|
639
|
2
|
|
|
|
|
1
|
my $val = shift; |
|
640
|
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
# Check if isa/ref/rx/value is allowed |
|
642
|
2
|
50
|
|
|
|
4
|
&_value_is_allowed( 'dirname', $val ) || throw Error::Simple("ERROR: VLGal::File::set_dirname, the specified value '$val' is not allowed."); |
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
# Assignment |
|
645
|
2
|
|
|
|
|
5
|
$self->{VLGal_File}{dirname} = $val; |
|
646
|
|
|
|
|
|
|
} |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
sub set_super_dir { |
|
649
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
650
|
1
|
|
|
|
|
2
|
my $val = shift; |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
# Check if isa/ref/rx/value is allowed |
|
653
|
1
|
50
|
|
|
|
3
|
&_value_is_allowed( 'super_dir', $val ) || throw Error::Simple("ERROR: VLGal::File::set_super_dir, the specified value '$val' is not allowed."); |
|
654
|
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
# Assignment |
|
656
|
1
|
|
|
|
|
10
|
$self->{VLGal_File}{super_dir} = $val; |
|
657
|
|
|
|
|
|
|
} |
|
658
|
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
1; |