New upstream version 1.33
gregor herrmann
2 years ago
5 | 5 | |
6 | 6 | TODO: |
7 | 7 | . connect to Message::Passing framework |
8 | ||
9 | version 1.33: Sat Jul 17 10:56:52 CEST 2021 | |
10 | ||
11 | Changes: | |
12 | - the $@->died with always return the original die causing object or | |
13 | string. In most cases, you want to use $@->wasFatal, which is the | |
14 | translated (hence compatible) ::Exception object. [Andy Beverley] | |
8 | 15 | |
9 | 16 | version 1.32: Tue 26 Jan 09:13:31 CET 2021 |
10 | 17 |
53 | 53 | "web" : "https://github.com/markov2/perl5-Log-Report" |
54 | 54 | } |
55 | 55 | }, |
56 | "version" : "1.32", | |
56 | "version" : "1.33", | |
57 | 57 | "x_serialization_backend" : "JSON::PP version 2.94" |
58 | 58 | } |
28 | 28 | homepage: http://perl.overmeer.net/CPAN/ |
29 | 29 | license: http://dev.perl.org/licenses/ |
30 | 30 | repository: https://github.com/markov2/perl5-Log-Report.git |
31 | version: '1.32' | |
31 | version: '1.33' | |
32 | 32 | x_serialization_backend: 'CPAN::Meta::YAML version 0.011' |
1 | 1 | |
2 | 2 | use 5.010; |
3 | 3 | |
4 | my $version = '1.32'; | |
4 | my $version = '1.33'; | |
5 | 5 | |
6 | 6 | my %prereq = |
7 | 7 | ( Test::More => '0.86' |
7 | 7 | |
8 | 8 | package Dancer::Logger::LogReport; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Dancer::Logger::Abstract', 'Exporter'; |
13 | 13 |
60 | 60 | |
61 | 61 | =head1 SEE ALSO |
62 | 62 | |
63 | This module is part of Log-Report distribution version 1.32, | |
64 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
63 | This module is part of Log-Report distribution version 1.33, | |
64 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
65 | 65 | |
66 | 66 | =head1 LICENSE |
67 | 67 |
7 | 7 | |
8 | 8 | package Dancer2::Logger::LogReport; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | # ABSTRACT: Dancer2 logger engine for Log::Report |
13 | 13 | |
37 | 37 | sub BUILD |
38 | 38 | { my $self = shift; |
39 | 39 | my $configs = $self->dispatchers || {default => undef}; |
40 | $self->{use} = [keys %$configs]; | |
40 | $self->{use} = [ keys %$configs ]; | |
41 | 41 | |
42 | 42 | dispatcher 'do-not-reopen'; |
43 | 43 |
70 | 70 | |
71 | 71 | =head1 SEE ALSO |
72 | 72 | |
73 | This module is part of Log-Report distribution version 1.32, | |
74 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
73 | This module is part of Log-Report distribution version 1.33, | |
74 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
75 | 75 | |
76 | 76 | =head1 LICENSE |
77 | 77 |
7 | 7 | |
8 | 8 | package Dancer2::Plugin::LogReport::Message; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use parent 'Log::Report::Message'; |
13 | 13 |
76 | 76 | |
77 | 77 | =head1 SEE ALSO |
78 | 78 | |
79 | This module is part of Log-Report distribution version 1.32, | |
80 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
79 | This module is part of Log-Report distribution version 1.33, | |
80 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
81 | 81 | |
82 | 82 | =head1 LICENSE |
83 | 83 |
7 | 7 | |
8 | 8 | package Dancer2::Plugin::LogReport; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | |
13 | 13 | use warnings; |
512 | 512 | |
513 | 513 | =head1 SEE ALSO |
514 | 514 | |
515 | This module is part of Log-Report distribution version 1.32, | |
516 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
515 | This module is part of Log-Report distribution version 1.33, | |
516 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
517 | 517 | |
518 | 518 | =head1 LICENSE |
519 | 519 |
7 | 7 | |
8 | 8 | package Log::Report::DBIC::Profiler; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'DBIx::Class::Storage::Statistics'; |
13 | 13 |
32 | 32 | |
33 | 33 | =head1 SEE ALSO |
34 | 34 | |
35 | This module is part of Log-Report distribution version 1.32, | |
36 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
35 | This module is part of Log-Report distribution version 1.33, | |
36 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
37 | 37 | |
38 | 38 | =head1 LICENSE |
39 | 39 |
7 | 7 | |
8 | 8 | package Log::Report::Die; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Exporter'; |
13 | 13 | |
30 | 30 | my %opt = (errno => $! + 0); |
31 | 31 | my $err = "$!"; |
32 | 32 | |
33 | my $dietxt = $text[0]; | |
34 | 33 | if($text[0] =~ s/ at (.+) line (\d+)\.?$// ) |
35 | 34 | { $opt{location} = [undef, $1, $2, undef]; |
36 | 35 | } |
60 | 59 | : @stack ? 'PANIC' |
61 | 60 | : $args{on_die} || 'ERROR'; |
62 | 61 | |
63 | ($dietxt, \%opt, $reason, join("\n", @msg)); | |
62 | (\%opt, $reason, join("\n", @msg)); | |
64 | 63 | } |
65 | 64 | |
66 | 65 | |
93 | 92 | : @stack ? 'PANIC' |
94 | 93 | : $on_die || 'ERROR'; |
95 | 94 | |
96 | ('caught '.ref $exception, \%opts, $reason, $message); | |
95 | (\%opts, $reason, $message); | |
97 | 96 | } |
98 | 97 | |
99 | 98 | my %_libxml_errno2reason = (1 => 'WARNING', 2 => 'MISTAKE', 3 => 'ERROR'); |
111 | 110 | . ' (' . $exc->domain . ' error ' . $exc->code . ')'; |
112 | 111 | |
113 | 112 | my $reason = $_libxml_errno2reason{$exc->level} || 'PANIC'; |
114 | ('caught '.ref $exc, \%opts, $reason, $msg); | |
113 | (\%opts, $reason, $msg); | |
115 | 114 | } |
116 | 115 | |
117 | 116 | sub exception_decode($%) |
126 | 125 | |
127 | 126 | # Unsupported exception system, sane guesses |
128 | 127 | my %opt = |
129 | ( classes => [ 'unknown exception', 'die', ref $exception ] | |
130 | , errno => $errno | |
131 | ); | |
128 | ( classes => [ 'unknown exception', 'die', ref $exception ] | |
129 | , errno => $errno | |
130 | ); | |
132 | 131 | |
133 | 132 | my $reason = $errno ? 'FAULT' : $args{on_die} || 'ERROR'; |
134 | 133 | |
135 | 134 | # hopefully stringification is overloaded |
136 | ( "caught ".ref $exception, \%opt, $reason, "$exception"); | |
135 | (\%opt, $reason, "$exception"); | |
137 | 136 | } |
138 | 137 | |
139 | 138 | "to die or not to die, that's the question"; |
29 | 29 | parameters for L<Log::Report::report()|Log::Report/"Report Production and Configuration">. This is done in a very |
30 | 30 | smart way, even trying to find the stringifications of C<$!>. |
31 | 31 | |
32 | Return are four elements: the error string which is used to trigger | |
33 | a C<Log::Report> compatible C<die()>, and the options, reason, and | |
34 | text message. The options is a HASH which, amongst other things, | |
35 | may contain a stack trace and location. | |
32 | Returned are four elements: the error string or object which triggered | |
33 | the death originally (the original $@), and the opts, reason, and plain | |
34 | text message. The opts is a HASH which, amongst other things, may contain | |
35 | a stack trace and location extracted from the death text or object. | |
36 | 36 | |
37 | 37 | Translated components will have exception classes C<perl>, and C<die> or |
38 | 38 | C<confess>. On the moment, the C<croak> cannot be distiguished from the |
77 | 77 | |
78 | 78 | =head1 SEE ALSO |
79 | 79 | |
80 | This module is part of Log-Report distribution version 1.32, | |
81 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
80 | This module is part of Log-Report distribution version 1.33, | |
81 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
82 | 82 | |
83 | 83 | =head1 LICENSE |
84 | 84 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::Callback; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
173 | 173 | |
174 | 174 | =head1 SEE ALSO |
175 | 175 | |
176 | This module is part of Log-Report distribution version 1.32, | |
177 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
176 | This module is part of Log-Report distribution version 1.33, | |
177 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
178 | 178 | |
179 | 179 | =head1 LICENSE |
180 | 180 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::File; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
258 | 258 | |
259 | 259 | =head1 SEE ALSO |
260 | 260 | |
261 | This module is part of Log-Report distribution version 1.32, | |
262 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
261 | This module is part of Log-Report distribution version 1.33, | |
262 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
263 | 263 | |
264 | 264 | =head1 LICENSE |
265 | 265 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::Log4perl; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
229 | 229 | |
230 | 230 | =head1 SEE ALSO |
231 | 231 | |
232 | This module is part of Log-Report distribution version 1.32, | |
233 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
232 | This module is part of Log-Report distribution version 1.33, | |
233 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
234 | 234 | |
235 | 235 | =head1 LICENSE |
236 | 236 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::LogDispatch; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
193 | 193 | |
194 | 194 | =head1 SEE ALSO |
195 | 195 | |
196 | This module is part of Log-Report distribution version 1.32, | |
197 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
196 | This module is part of Log-Report distribution version 1.33, | |
197 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
198 | 198 | |
199 | 199 | =head1 LICENSE |
200 | 200 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::Perl; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
38 | 38 | |
39 | 39 | =head1 SEE ALSO |
40 | 40 | |
41 | This module is part of Log-Report distribution version 1.32, | |
42 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
41 | This module is part of Log-Report distribution version 1.33, | |
42 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
43 | 43 | |
44 | 44 | =head1 LICENSE |
45 | 45 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::Syslog; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
222 | 222 | |
223 | 223 | =head1 SEE ALSO |
224 | 224 | |
225 | This module is part of Log-Report distribution version 1.32, | |
226 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
225 | This module is part of Log-Report distribution version 1.33, | |
226 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
227 | 227 | |
228 | 228 | =head1 LICENSE |
229 | 229 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher::Try; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Dispatcher'; |
13 | 13 |
101 | 101 | |
102 | 102 | =item died => STRING |
103 | 103 | |
104 | The exit string ($@) of the eval'ed block. | |
104 | The exit string or object ($@) of the eval'ed block, in its unprocessed state. | |
105 | 105 | |
106 | 106 | =item exceptions => ARRAY |
107 | 107 | |
140 | 140 | |
141 | 141 | =item $obj-E<gt>B<died>( [STRING] ) |
142 | 142 | |
143 | The message which was reported by C<eval>, which is used internally | |
144 | to catch problems in the try block. | |
143 | The exit string or object ($@) of the eval'ed block, in its unprocessed state. | |
144 | They will always return true when they where deadly, and it always stringifies | |
145 | into something useful. | |
145 | 146 | |
146 | 147 | =item $obj-E<gt>B<exceptions>() |
147 | 148 | |
321 | 322 | |
322 | 323 | =head1 SEE ALSO |
323 | 324 | |
324 | This module is part of Log-Report distribution version 1.32, | |
325 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
325 | This module is part of Log-Report distribution version 1.33, | |
326 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
326 | 327 | |
327 | 328 | =head1 LICENSE |
328 | 329 |
7 | 7 | |
8 | 8 | package Log::Report::Dispatcher; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | |
13 | 13 | use warnings; |
394 | 394 | |
395 | 395 | =head1 SEE ALSO |
396 | 396 | |
397 | This module is part of Log-Report distribution version 1.32, | |
398 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
397 | This module is part of Log-Report distribution version 1.33, | |
398 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
399 | 399 | |
400 | 400 | =head1 LICENSE |
401 | 401 |
7 | 7 | |
8 | 8 | package Log::Report::Domain; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Log::Report::Minimal::Domain'; |
13 | 13 |
283 | 283 | |
284 | 284 | =head1 SEE ALSO |
285 | 285 | |
286 | This module is part of Log-Report distribution version 1.32, | |
287 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
286 | This module is part of Log-Report distribution version 1.33, | |
287 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
288 | 288 | |
289 | 289 | =head1 LICENSE |
290 | 290 |
7 | 7 | |
8 | 8 | package Log::Report::Exception; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | |
13 | 13 | use warnings; |
151 | 151 | |
152 | 152 | =head1 SEE ALSO |
153 | 153 | |
154 | This module is part of Log-Report distribution version 1.32, | |
155 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
154 | This module is part of Log-Report distribution version 1.33, | |
155 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
156 | 156 | |
157 | 157 | =head1 LICENSE |
158 | 158 |
7 | 7 | |
8 | 8 | package Log::Report::Message; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | |
13 | 13 | use warnings; |
552 | 552 | |
553 | 553 | =head1 SEE ALSO |
554 | 554 | |
555 | This module is part of Log-Report distribution version 1.32, | |
556 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
555 | This module is part of Log-Report distribution version 1.33, | |
556 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
557 | 557 | |
558 | 558 | =head1 LICENSE |
559 | 559 |
7 | 7 | |
8 | 8 | package Log::Report::Translator; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | |
13 | 13 | use warnings; |
65 | 65 | |
66 | 66 | =head1 SEE ALSO |
67 | 67 | |
68 | This module is part of Log-Report distribution version 1.32, | |
69 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
68 | This module is part of Log-Report distribution version 1.33, | |
69 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
70 | 70 | |
71 | 71 | =head1 LICENSE |
72 | 72 |
7 | 7 | |
8 | 8 | package Log::Report; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use base 'Exporter'; |
13 | 13 | |
313 | 313 | my $is_exception = blessed $err && $err->isa('Log::Report::Exception'); |
314 | 314 | if(!$is_exception && $err && !$disp->wasFatal) |
315 | 315 | { # Decode exceptions which do not origin from Log::Report reports |
316 | ($err, my($opts, $reason, $text)) = blessed $err | |
316 | my($opts, $reason, $text) = blessed $err | |
317 | 317 | ? Log::Report::Die::exception_decode($err) |
318 | 318 | : Log::Report::Die::die_decode($err, on_die => $disp->die2reason); |
319 | 319 |
1158 | 1158 | |
1159 | 1159 | =head1 SEE ALSO |
1160 | 1160 | |
1161 | This module is part of Log-Report distribution version 1.32, | |
1162 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
1161 | This module is part of Log-Report distribution version 1.33, | |
1162 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
1163 | 1163 | |
1164 | 1164 | =head1 LICENSE |
1165 | 1165 |
7 | 7 | |
8 | 8 | package MojoX::Log::Report; |
9 | 9 | use vars '$VERSION'; |
10 | $VERSION = '1.32'; | |
10 | $VERSION = '1.33'; | |
11 | 11 | |
12 | 12 | use Mojo::Base 'Mojo::Log'; # implies use strict etc |
13 | 13 |
48 | 48 | |
49 | 49 | =head1 SEE ALSO |
50 | 50 | |
51 | This module is part of Log-Report distribution version 1.32, | |
52 | built on January 26, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
51 | This module is part of Log-Report distribution version 1.33, | |
52 | built on July 17, 2021. Website: F<http://perl.overmeer.net/CPAN/> | |
53 | 53 | |
54 | 54 | =head1 LICENSE |
55 | 55 |
24 | 24 | __WITHOUT_STACKTRACE |
25 | 25 | |
26 | 26 | is_deeply [ exception_decode(exception $dbix1) ] |
27 | , [ 'caught DBIx::Class::Exception' | |
28 | , { location => [ $0, '/tmp/a.pl', '6', undef ] } | |
27 | , [ { location => [ $0, '/tmp/a.pl', '6', undef ] } | |
29 | 28 | , 'ERROR' |
30 | 29 | , 'help' |
31 | 30 | ], 'set 1'; |
37 | 36 | __WITH_STACKTRACE |
38 | 37 | |
39 | 38 | is_deeply [ exception_decode(exception $dbix2) ] |
40 | , [ 'caught DBIx::Class::Exception' | |
41 | , { location => [ 'main', '/tmp/a.pl', '6', 'f' ] | |
39 | , [ { location => [ 'main', '/tmp/a.pl', '6', 'f' ] | |
42 | 40 | , stack => [ [ 'main::f', '/tmp/a.pl', '8' ] |
43 | 41 | , [ 'main::g', '/tmp/a.pl', '10' ] |
44 | 42 | ] |
52 | 50 | __WITHOUT_STACKTRACE |
53 | 51 | |
54 | 52 | is_deeply [ exception_decode(exception $dbix3) ] |
55 | , [ 'caught DBIx::Class::Exception' | |
56 | , { location => [ $0, '/tmp/a.pl', '6', undef ] } | |
53 | , [ { location => [ $0, '/tmp/a.pl', '6', undef ] } | |
57 | 54 | , 'ERROR' |
58 | 55 | , 'help' |
59 | 56 | ], 'set 3'; |
65 | 62 | #warn "DBIx4:", Dumper exception_decode(exception $dbix4); |
66 | 63 | |
67 | 64 | is_deeply [ exception_decode(exception $dbix4) ] |
68 | , [ 'caught DBIx::Class::Exception' | |
69 | , { location => | |
65 | , [ { location => | |
70 | 66 | [ 'DBIx::Class::Storage::DBI' |
71 | 67 | , '/home/abeverley/git/Isaas/bin/../lib/Isaas/DBIC.pm' |
72 | 68 | , '18' |
29 | 29 | my $msg = pop @dec; |
30 | 30 | |
31 | 31 | # error code changed from libxml2 2.9.9 to 2.9.10 |
32 | my $rc = delete $dec[1]{errno}; | |
33 | $dec[1]{errno} = 'RC'; | |
32 | my $rc = delete $dec[0]{errno}; | |
33 | $dec[0]{errno} = 'RC'; | |
34 | 34 | cmp_ok $rc, '>', 13000, 'error code'; |
35 | 35 | |
36 | 36 | is_deeply \@dec, |
37 | , [ 'caught XML::LibXML::Error' | |
38 | , { location => [ 'libxml', '', '1', 'parser' ], errno => 'RC' } | |
37 | , [ { location => [ 'libxml', '', '1', 'parser' ], errno => 'RC' } | |
39 | 38 | , 'ERROR' |
40 | 39 | ], 'error 1'; |
41 | 40 |
3 | 3 | # Pod stripped from pm file by OODoc 2.02. |
4 | 4 | package DieTests; |
5 | 5 | use vars '$VERSION'; |
6 | $VERSION = '1.32'; | |
6 | $VERSION = '1.33'; | |
7 | 7 | |
8 | 8 | use warnings; |
9 | 9 | use strict; |
28 | 28 | my $errstr = "$!"; |
29 | 29 | |
30 | 30 | sub process($) |
31 | { | |
32 | my ($err, $opt, $reason, $message) = die_decode shift; | |
33 | $err =~ s/\d+\.?$/XX/; | |
31 | { my $err = shift; | |
32 | my ($opt, $reason, $message) = die_decode $err; | |
33 | # $err =~ s/\d+\.?$/XX/; | |
34 | 34 | my $errno = $opt->{errno} || 'no errno'; |
35 | 35 | my $loc = $opt->{location}; |
36 | 36 | my $loca = $loc ? "$loc->[1]#XX" : 'no location'; |
37 | 37 | my $stack = join "\n", |
38 | 38 | map { join '#', $_->[0], $_->[1], 'XX' } |
39 | 39 | @{$opt->{stack}}; |
40 | ||
40 | 41 | my $r = <<__RESULT; |
41 | 42 | $reason: $message ($errno) |
42 | $err | |
43 | 43 | $loca |
44 | 44 | $stack |
45 | 45 | __RESULT |
62 | 62 | my $die_text1 = $@; |
63 | 63 | is(process($die_text1), <<__OUT, "die"); |
64 | 64 | ERROR: ouch (no errno) |
65 | ouch at t/DieTests.pm line XX | |
66 | 65 | t/DieTests.pm#XX |
67 | 66 | |
68 | 67 | __OUT |
71 | 70 | my $die_text2 = $@; |
72 | 71 | is(process($die_text2), <<__OUT, "die"); |
73 | 72 | ERROR: ouch (no errno) |
74 | ouch | |
75 | 73 | no location |
76 | 74 | |
77 | 75 | __OUT |
80 | 78 | my $die_text3 = $@; |
81 | 79 | is(process($die_text3), <<__OUT, "die"); |
82 | 80 | FAULT: ouch (3) |
83 | ouch No such process at t/DieTests.pm line XX | |
84 | 81 | t/DieTests.pm#XX |
85 | 82 | |
86 | 83 | __OUT |
89 | 86 | my $die_text4 = $@; |
90 | 87 | is(process($die_text4), <<__OUT, "die"); |
91 | 88 | FAULT: ouch (3) |
92 | ouch No such process | |
93 | 89 | no location |
94 | 90 | |
95 | 91 | __OUT |
100 | 96 | my $croak_text1 = $@; |
101 | 97 | is(process($croak_text1), <<__OUT, "croak"); |
102 | 98 | ERROR: ouch (no errno) |
103 | ouch at t/41die.t line XX | |
104 | 99 | t/41die.t#XX |
105 | 100 | |
106 | 101 | __OUT |
109 | 104 | my $croak_text2 = $@; |
110 | 105 | is(process($croak_text2), <<__OUT, "croak"); |
111 | 106 | ERROR: ouch (no errno) |
112 | ouch | |
113 | 107 | t/41die.t#XX |
114 | 108 | |
115 | 109 | __OUT |
118 | 112 | my $croak_text3 = $@; |
119 | 113 | is(process($croak_text3), <<__OUT, "croak"); |
120 | 114 | FAULT: ouch (3) |
121 | ouch No such process at t/41die.t line XX | |
122 | 115 | t/41die.t#XX |
123 | 116 | |
124 | 117 | __OUT |
127 | 120 | my $croak_text4 = $@; |
128 | 121 | is(process($croak_text4), <<__OUT, "croak"); |
129 | 122 | FAULT: ouch (3) |
130 | ouch No such process | |
131 | 123 | t/41die.t#XX |
132 | 124 | |
133 | 125 | __OUT |
138 | 130 | my $confess_text1 = $@; |
139 | 131 | is(process($confess_text1), <<__OUT, "confess"); |
140 | 132 | PANIC: ouch (no errno) |
141 | ouch at t/DieTests.pm line XX | |
142 | 133 | t/DieTests.pm#XX |
143 | 134 | eval {...}#t/DieTests.pm#XX |
144 | 135 | DieTests::run_tests()#t/41die.t#XX |
149 | 140 | my $confess_text2 = $@; |
150 | 141 | is(process($confess_text2), <<__OUT, "confess"); |
151 | 142 | PANIC: ouch (no errno) |
152 | ouch | |
153 | 143 | t/DieTests.pm#XX |
154 | 144 | eval {...}#t/DieTests.pm#XX |
155 | 145 | DieTests::run_tests()#t/41die.t#XX |
160 | 150 | my $confess_text3 = $@; |
161 | 151 | is(process($confess_text3), <<__OUT, "confess"); |
162 | 152 | FAULT: ouch (3) |
163 | ouch No such process at t/DieTests.pm line XX | |
164 | 153 | t/DieTests.pm#XX |
165 | 154 | eval {...}#t/DieTests.pm#XX |
166 | 155 | DieTests::run_tests()#t/41die.t#XX |
179 | 168 | my $confess_text4 = $@; |
180 | 169 | is(process($confess_text4), <<__OUT, "confess"); |
181 | 170 | FAULT: ouch (3) |
182 | ouch No such process | |
183 | 171 | t/DieTests.pm#XX |
184 | 172 | eval {...}#t/DieTests.pm#XX |
185 | 173 | DieTests::run_tests()#t/41die.t#XX |