Codebase list liblog-report-perl / v1.14
distribution Log-Report-1.14.tar.gz Mark Overmeer authored 8 years ago Mark Overmeer committed 6 years ago
5 changed file(s) with 37 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
55
66 TODO:
77 . connect to Message::Passing framework
8
9 version 1.14: Tue 12 Apr 15:10:27 CEST 2016
10
11 Fixes:
12 - dancer2: regression test only for recent Dancer2 [cpantesters]
13
14 Improvements:
15 - typo rt.cpan.org#111985 [Gregor Herrmann, Debian]
16 - dancer2: treat all exceptions equal [Andrew Beverley]
817
918 version 1.13: Wed 3 Feb 11:34:18 CET 2016
1019
11
22 use 5.008;
33
4 my $version = '1.13';
4 my $version = '1.14';
55
66 my %prereq =
77 ( Test::More => '0.86'
263263 { my ($disp, $options, $reason, $message) = @_;
264264
265265 my $fatal_handler = sub {
266 my $req = $_dsl->request;
267 _forward_home( $_dsl, $_[0] )
268 if $req && ($req->uri ne '/' || !$req->is_get);
266
267 # Check whether this fatal message has been caught, in which case we
268 # don't want to redirect
269 return _message_add($_[0])
270 if exists $options->{is_fatal} && !$options->{is_fatal};
271
272 my $req = $_dsl->request
273 or return;
274
275 # Don't forward if it's a GET request to the error page, as it will
276 # cause a recursive loop. In this case, do nothing, and let dancer
277 # handle it.
278 # return not needed because of Return::MultiLevel hack, but let's
279 # leave it in anyway in hope.
280 return _forward_home($_dsl, $_[0])
281 if $req->uri ne $_settings->{forward_url} || !$req->is_get;
282
283 return;
269284 };
270285
271286 $message->reason($reason);
278293 # This could have already been caught by the process
279294 # subroutine, in which case we should continue running
280295 # of the program. In all other cases, we should bail
281 # out. With the former, the exception will have been
282 # re-thrown as a non-fatal exception, so check that.
283 , ERROR => sub {
284 return _message_add( $_[0] )
285 if exists $options->{is_fatal} && !$options->{is_fatal};
286
287 my $req = $_dsl->request;
288 return _forward_home( $_dsl, $_[0] )
289 if $req && ($req->uri ne '/' || !$req->is_get);
290
291 return;
292 }
296 # out.
297 , ERROR => $fatal_handler
293298
294299 # 'FAULT', 'ALERT', 'FAILURE', 'PANIC'
295 # All these are fatal errors. Display error to user, but
296 # forward home so that we can reload. However, don't if
297 # it's a GET request to the home, as it will cause a recursive
298 # loop. In this case, do nothing, and let dancer handle it.
300 # All these are fatal errors.
299301 , FAULT => $fatal_handler
300302 , ALERT => $fatal_handler
301303 , FAILURE => $fatal_handler
8686 =option facility STRING
8787 =default facility 'user'
8888 The possible values for this depend (a little) on the system. POSIX
89 only defines C<user>, and C<local0> upto C<local7>.
89 only defines C<user>, and C<local0> up to C<local7>.
9090
9191 =option to_prio ARRAY-of-PAIRS
9292 =default to_prio []
77 eval "require Dancer2";
88 plan skip_all => 'Dancer2 is not installed'
99 if $@;
10
11 plan skip_all => "Dancer2 is too old: $Dancer2::VERSION"
12 if $Dancer2::VERSION < 0.151000; # for to_app()
13
14 warn "Dancer2 version $Dancer2::VERSION\n";
1015
1116 plan tests => 5;
1217