line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Exception::AggregateConfiguration; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
39885
|
use 5.006001; |
|
26
|
|
|
|
|
66
|
|
4
|
26
|
|
|
26
|
|
116
|
use strict; |
|
26
|
|
|
|
|
36
|
|
|
26
|
|
|
|
|
557
|
|
5
|
26
|
|
|
26
|
|
99
|
use warnings; |
|
26
|
|
|
|
|
36
|
|
|
26
|
|
|
|
|
1378
|
|
6
|
|
|
|
|
|
|
|
7
|
26
|
|
|
26
|
|
110
|
use Carp qw{ confess }; |
|
26
|
|
|
|
|
34
|
|
|
26
|
|
|
|
|
1502
|
|
8
|
26
|
|
|
26
|
|
618
|
use English qw(-no_match_vars); |
|
26
|
|
|
|
|
3577
|
|
|
26
|
|
|
|
|
169
|
|
9
|
26
|
|
|
26
|
|
11027
|
use Readonly; |
|
26
|
|
|
|
|
5153
|
|
|
26
|
|
|
|
|
1298
|
|
10
|
|
|
|
|
|
|
|
11
|
26
|
|
|
26
|
|
7060
|
use Perl::ToPerl6::Utils qw{ :characters }; |
|
26
|
|
|
|
|
62
|
|
|
26
|
|
|
|
|
1550
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.031'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Exception::Class ( |
18
|
26
|
|
|
|
|
387
|
'Perl::ToPerl6::Exception::AggregateConfiguration' => { |
19
|
|
|
|
|
|
|
isa => 'Perl::ToPerl6::Exception', |
20
|
|
|
|
|
|
|
description => 'A collected set of configuration exceptions.', |
21
|
|
|
|
|
|
|
fields => [ qw{ exceptions } ], |
22
|
|
|
|
|
|
|
alias => 'throw_aggregate', |
23
|
|
|
|
|
|
|
}, |
24
|
26
|
|
|
26
|
|
11229
|
); |
|
26
|
|
|
|
|
47
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw< throw_aggregate >; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
4366
|
|
|
4366
|
1
|
10498
|
my ($class, %options) = @_; |
34
|
|
|
|
|
|
|
|
35
|
4366
|
|
|
|
|
5941
|
my $exceptions = $options{exceptions}; |
36
|
4366
|
50
|
|
|
|
8652
|
if (not $exceptions) { |
37
|
4366
|
|
|
|
|
7948
|
$options{exceptions} = []; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
4366
|
|
|
|
|
16156
|
return $class->SUPER::new(%options); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub add_exception { |
46
|
60
|
|
|
60
|
1
|
29075
|
my ( $self, $exception ) = @_; |
47
|
|
|
|
|
|
|
|
48
|
60
|
|
|
|
|
88
|
push @{ $self->exceptions() }, $exception; |
|
60
|
|
|
|
|
1354
|
|
49
|
|
|
|
|
|
|
|
50
|
60
|
|
|
|
|
408
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub add_exceptions_from { |
56
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $aggregate ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
push @{ $self->exceptions() }, @{ $aggregate->exceptions() }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
0
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub add_exception_or_rethrow { |
66
|
1254
|
|
|
1254
|
1
|
1600
|
my ( $self, $eval_error ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
1254
|
50
|
|
|
|
3003
|
return if not $eval_error; |
69
|
0
|
0
|
|
|
|
0
|
confess $eval_error if not ref $eval_error; |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
0
|
if ( $eval_error->isa('Perl::ToPerl6::Exception::Configuration') ) { |
|
|
0
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
$self->add_exception($eval_error); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
elsif ( |
75
|
|
|
|
|
|
|
$eval_error->isa('Perl::ToPerl6::Exception::AggregateConfiguration') |
76
|
|
|
|
|
|
|
) { |
77
|
0
|
|
|
|
|
0
|
$self->add_exceptions_from($eval_error); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
else { |
80
|
0
|
|
|
|
|
0
|
die $eval_error; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub has_exceptions { |
89
|
4395
|
|
|
4395
|
1
|
5561
|
my ( $self ) = @_; |
90
|
|
|
|
|
|
|
|
91
|
4395
|
100
|
|
|
|
3792
|
return @{ $self->exceptions() } ? 1 : 0; |
|
4395
|
|
|
|
|
91091
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Readonly::Scalar my $MESSAGE_PREFIX => $EMPTY; |
97
|
|
|
|
|
|
|
Readonly::Scalar my $MESSAGE_SUFFIX => "\n"; |
98
|
|
|
|
|
|
|
Readonly::Scalar my $MESSAGE_SEPARATOR => $MESSAGE_SUFFIX . $MESSAGE_PREFIX; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub full_message { |
101
|
45
|
|
|
45
|
1
|
9690
|
my ( $self ) = @_; |
102
|
|
|
|
|
|
|
|
103
|
45
|
|
|
|
|
98
|
my $message = $MESSAGE_PREFIX; |
104
|
45
|
|
|
|
|
73
|
$message .= join $MESSAGE_SEPARATOR, @{ $self->exceptions() }; |
|
45
|
|
|
|
|
1157
|
|
105
|
45
|
|
|
|
|
39450
|
$message .= $MESSAGE_SUFFIX; |
106
|
|
|
|
|
|
|
|
107
|
45
|
|
|
|
|
132
|
return $message; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=for stopwords |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 NAME |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Perl::ToPerl6::Exception::AggregateConfiguration - A collection of a set of problems found in the configuration and/or command-line options. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 DESCRIPTION |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
A set of configuration settings can have multiple problems. This is |
127
|
|
|
|
|
|
|
an object for collecting all the problems found so that the user can |
128
|
|
|
|
|
|
|
see them in one run. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 INTERFACE SUPPORT |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This is considered to be a public class. Any changes to its interface |
134
|
|
|
|
|
|
|
will go through a deprecation cycle. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 METHODS |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=over |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item C<add_exception( $exception )> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Accumulate the parameter with rest of the exceptions. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item C<add_exceptions_from( $aggregate )> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Accumulate the exceptions from another instance of this class. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item C<exceptions()> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Returns a reference to an array of the collected exceptions. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item C<add_exception_or_rethrow( $eval_error )> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
If the parameter is an instance of |
159
|
|
|
|
|
|
|
L<Perl::ToPerl6::Exception::Configuration|Perl::ToPerl6::Exception::Configuration> |
160
|
|
|
|
|
|
|
or |
161
|
|
|
|
|
|
|
L<Perl::ToPerl6::Exception::AggregateConfiguration|Perl::ToPerl6::Exception::AggregateConfiguration>, |
162
|
|
|
|
|
|
|
add it. Otherwise, C<die> with the parameter, if it is a reference, |
163
|
|
|
|
|
|
|
or C<confess> with it. If the parameter is false, simply returns. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item C<has_exceptions()> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Answer whether any configuration problems have been found. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item C<full_message()> |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Concatenate the exception messages. See |
174
|
|
|
|
|
|
|
L<Exception::Class/"full_message">. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 AUTHOR |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Elliot Shank <perl@galumph.com> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 COPYRIGHT |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Copyright (c) 2007-2011 Elliot Shank. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
189
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of this license |
190
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
############################################################################## |
195
|
|
|
|
|
|
|
# Local Variables: |
196
|
|
|
|
|
|
|
# mode: cperl |
197
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
198
|
|
|
|
|
|
|
# fill-column: 78 |
199
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
200
|
|
|
|
|
|
|
# c-indentation-style: bsd |
201
|
|
|
|
|
|
|
# End: |
202
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |