Trace-Mask
view release on metacpan or search on metacpan
lib/Trace/Mask/Carp.pm view on Meta::CPAN
7172737475767778798081828384858687888990
};
}
sub
_wrap_carp {
no
warnings
'redefine'
;
*Carp::confess
= \
&confess
;
*Carp::longmess
= \
&longmess
;
*Carp::cluck
= \
&cluck
;
}
sub
mask(&) {
my
(
$code
) =
@_
;
my
$sigwarn
=
$SIG
{__WARN__};
my
$sigdie
=
$SIG
{__DIE__};
local
$SIG
{__WARN__};
local
$SIG
{__DIE__};
$SIG
{__WARN__} =
$sigwarn
if
$sigwarn
;
$SIG
{__DIE__} =
$sigdie
if
$sigdie
;
lib/Trace/Mask/Reference.pm view on Meta::CPAN
91011121314151617181920212223242526272829our
@EXPORT_OK
=
qw{
trace
trace_string
trace_mask_caller
try_example
}
;
sub
try_example(&) {
my
$code
=
shift
;
local
$@;
my
$ok
=
eval
{
# Hides the call, the eval, and the call to try_example
# This also has the added benefit that if there was an exception inside
# try_example itself, the trace would not hide anything. The hide only
# effects traces from inside the anonymous sub.
BEGIN { mask_line({
hide
=> 3}, 1) }
$code
->();
1;
17181920212223242526272829303132333435363738imported_ok(
qw{
update_mask
validate_mask
get_mask
mask_line
mask_call
mask_sub
mask_frame
}
);
sub
foo(&) {
$_
[0]->(
@_
) }
sub
bar(&) {
$_
[0]->(
@_
) }
tests
validate_mask
=>
sub
{
is(
[validate_mask({
hide
=> 1,
no_start
=> 1,
stop
=> 1,
shift
=> 3,
0
=>
'foo'
,
10
=>
'bar'
,
100
=>
'baz'
})],
[],
"Valid"
);
is(
[validate_mask()],
( run in 0.282 second using v1.01-cache-2.11-cpan-e5176c747c2 )