| 1 | package Devel::DieHandler::DumpDieArgs; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Data::Dmp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||
| 9 | 1 | our $DATE = '2022-10-27'; # DATE | |||||||||
| 10 | 1 | our $DIST = 'Devel-DieHandler-DumpDieArgs'; # DIST | |||||||||
| 11 | 1 | our $VERSION = '0.001'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | 1 | my @handler_stack; | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub import { | ||||||||
|
Subroutine
import: not called CC=2 SCAR=17.9
| |||||||||||
| 16 | 0 | my $pkg = shift; | |||||||||
| 17 | 0 | ▶ | push @handler_stack, $SIG{__DIE__} if $SIG{__DIE__}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 0 | ▶ | $SIG{__DIE__} = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 19 | 0 | local $SIG{__DIE__}; | |||||||||
| 20 | 0 | print STDERR "Content of \@_: ", Data::Dmp::dmp(\@_), "\n"; | |||||||||
| 21 | 0 | ▶ | if (@handler_stack) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | goto &{$handler_stack[-1]}; | |||||||||
| 23 | } else { | ||||||||||
| 24 | 0 | die @_; | |||||||||
| 25 | } | ||||||||||
| 26 | 0 | }; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub unimport { | ||||||||
|
Subroutine
unimport: not called CC=2 SCAR=17.9
| |||||||||||
| 30 | 0 | my $pkg = shift; | |||||||||
| 31 | 0 | ▶ | if (@handler_stack) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | $SIG{__DIE__} = pop(@handler_stack); | |||||||||
| 33 | } | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 1 | 1; | |||||||||
| 37 | # ABSTRACT: Dump content of die arguments | ||||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||