Trace-Mask

 view release on metacpan or  search on metacpan

lib/Trace/Mask/Carp.pm  view on Meta::CPAN

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
    };
}
 
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

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use Trace::Mask::Util qw/mask_frame mask_line get_mask/;
 
our @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;

t/Util.t  view on Meta::CPAN

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
imported_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 )