line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# mamgal - a program for creating static image galleries |
2
|
|
|
|
|
|
|
# Copyright 2007-2009 Marcin Owsiany |
3
|
|
|
|
|
|
|
# See the README file for license information |
4
|
|
|
|
|
|
|
# Exception class definitions. |
5
|
|
|
|
|
|
|
package App::MaMGal::Exceptions; |
6
|
10
|
|
|
10
|
|
822
|
use strict; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
233
|
|
7
|
10
|
|
|
10
|
|
42
|
use warnings; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
205
|
|
8
|
10
|
|
|
10
|
|
45
|
use Carp; |
|
10
|
|
|
|
|
13
|
|
|
10
|
|
|
|
|
798
|
|
9
|
|
|
|
|
|
|
use Exception::Class ( |
10
|
10
|
|
|
|
|
98
|
'App::MaMGal::MplayerWrapper::NotAvailableException', |
11
|
|
|
|
|
|
|
'App::MaMGal::MplayerWrapper::ExecutionFailureException' => { |
12
|
|
|
|
|
|
|
fields => [qw(stdout stderr)], |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
'App::MaMGal::SystemException' => { |
15
|
|
|
|
|
|
|
fields => [qw(objects)], |
16
|
|
|
|
|
|
|
} |
17
|
10
|
|
|
10
|
|
7043
|
); |
|
10
|
|
|
|
|
83762
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package App::MaMGal::MplayerWrapper::NotAvailableException; |
20
|
10
|
|
|
10
|
|
6942
|
use strict; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
178
|
|
21
|
10
|
|
|
10
|
|
44
|
use warnings; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
269
|
|
22
|
10
|
|
|
10
|
|
47
|
use Carp; |
|
10
|
|
|
|
|
43
|
|
|
10
|
|
|
|
|
1288
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _initialize |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
27
|
0
|
0
|
|
|
|
0
|
croak "this exception does not accept arguments" if @_; |
28
|
0
|
|
|
|
|
0
|
$self->SUPER::_initialize(@_); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub message |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
34
|
0
|
|
|
|
|
0
|
'mplayer is not available - films will not be represented by snapshots.' |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
package App::MaMGal::MplayerWrapper::ExecutionFailureException; |
38
|
10
|
|
|
10
|
|
46
|
use strict; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
198
|
|
39
|
10
|
|
|
10
|
|
40
|
use warnings; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
223
|
|
40
|
10
|
|
|
10
|
|
42
|
use Carp; |
|
10
|
|
|
|
|
95
|
|
|
10
|
|
|
|
|
1061
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _initialize |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
45
|
0
|
|
|
|
|
0
|
$self->SUPER::_initialize(@_); |
46
|
0
|
0
|
|
|
|
0
|
croak "This exception requires a message argument" unless $self->message; |
47
|
0
|
0
|
0
|
|
|
0
|
croak "Either one or three arguments are required" if $self->stdout xor $self->stderr; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
package App::MaMGal::SystemException; |
51
|
10
|
|
|
10
|
|
50
|
use strict; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
182
|
|
52
|
10
|
|
|
10
|
|
42
|
use warnings; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
230
|
|
53
|
10
|
|
|
10
|
|
45
|
use Carp; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
2088
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _initialize |
56
|
|
|
|
|
|
|
{ |
57
|
7
|
|
|
7
|
|
7108
|
my $self = shift; |
58
|
7
|
|
|
|
|
21
|
$self->SUPER::_initialize(@_); |
59
|
7
|
100
|
|
|
|
4545
|
croak "This exception requires a message argument" unless $self->message; |
60
|
|
|
|
|
|
|
# zero-width negative look-ahead assertion: a percent not followed by percent |
61
|
6
|
|
|
|
|
36
|
my $placeholder_count = () = $self->message =~ /%(?!%)/g; |
62
|
6
|
100
|
|
|
|
158
|
my $object_count = $self->objects ? scalar @{$self->objects} : 0; |
|
4
|
|
|
|
|
88
|
|
63
|
6
|
100
|
|
|
|
65
|
croak "Message with $placeholder_count placeholders must be followed by this many arguments, not $object_count" unless $placeholder_count == $object_count; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub interpolated_message |
67
|
|
|
|
|
|
|
{ |
68
|
2
|
|
|
2
|
|
2334
|
my $self = shift; |
69
|
2
|
100
|
|
|
|
45
|
my @args = $self->objects ? @{$self->objects} : (); |
|
1
|
|
|
|
|
24
|
|
70
|
2
|
|
|
|
|
12
|
sprintf($self->message, @args); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |