Trace-Mask

 view release on metacpan or  search on metacpan

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

    };
}

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

use Trace::Mask::Util qw/mask_frame mask_line get_mask/;

use base 'Exporter';
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

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.957 second using v1.01-cache-2.11-cpan-49f99fa48dc )