Trace-Mask
view release on metacpan or search on metacpan
lib/Trace/Mask.pm view on Meta::CPAN
shift.
=back
=head2 MASK RESOLUTION
Multiple masks in the C<%Trace::Mask::MASKS> structure may apply to any given
stack frame, a compliant tracer will account for all of them. A simple hash
merge is sufficient so long as they are merged in the correct order. Here is an
example:
my $masks_ref = \%Trace::Mask::MASKS;
my @all = grep { defined $_ } (
$masks_ref->{$file}->{'*'}->{'*'},
$masks_ref->{$file}->{$line}->{'*'},
$masks_ref->{'*'}->{'*'}->{$name},
$masks_ref->{$file}->{'*'}->{$name},
$masks_ref->{$file}->{$line}->{$name},
);
my %final = map { %{$_} } @all;
The most specific path should win out (override others). Rightmost path
component is considered the most important. More wildcards means less specific.
Paths may never have wildcards for all 3 components.
=head2 $ENV{'NO_TRACE_MASK'}
If this environment variable is set to true then all masking rules should be
ignored, tracers should produce full and complete stack traces.
=head2 TRACES STARTING AT $LEVEL
If a tracing tool starts at the call to the tool (such as C<Carp::confess()>)
then it should account for all the masks starting with the call to confess
itself going all the way until the bottom of the stack, or until a mask with
'stop' is found. If a tracing tool allows you to start tracing from a specific
level, the tracer should still account for the masks of the frames at the top
of the stack on which it is not reporting.
=head2 MASK NUMERIC KEYS
Numeric keys in a mask represent items in the list returned from C<caller()>.
If you provide numeric keys their values will replace the corresponding value
in the caller list before it is used in the trace. You can use this to replace
the package, file, etc. This will work for any VALID index into the list. This
cannot be used to extend the list. Numeric keys outside the bounds of the list
are simply ignored, this is for compatability as different perl versions may
have a different size list.
=head2 SPECIAL/MAGIC subs
Traces must NEVER hide or alter the following special/magic subs, they should
be considered the same as any C<lock> frame.
=over 4
=item BEGIN
=item UNITCHECK
=item CHECK
=item INIT
=item END
=item DESTROY
=item import
=item unimport
=back
These subs are all special in one way or another, hiding them would be hiding
critical information.
=head1 CLASS METHODS
The C<masks()> method is defined in L<Trace::Mask>, it returns a reference to
the C<%Trace::Mask::MASKS> hash for easy access. It is fine to cache this
reference, but not the data it contains.
=head1 REFERENCE
L<Trace::Mask::Reference> is included in this distribution. The Reference
module contains example tracers, and example tools that benefit from masking
stack traces. The examples in this module should NOT be used in production
code.
=head1 UTILS
L<Trace::Mask::Util> is included in this distribution. The util module provides
utilities for adding stack trace masking behavior. The utilities provided by
this module are considered usable in production code.
=head1 TEST
L<Trace::Mask::Test> is included in this distribution. This module provides
test cases and tools useful for verifying your tracing tools are compliant with
the spec.
=head1 PLUGINS
=head2 Carp
L<Trace::Mask::Carp> is included in this distribution. This module can make
L<Carp> compliant with L<Trace::Mask>.
=head2 Try::Tiny
L<Trace::Mask::TryTiny> is included in this ditribution. Simply loading theis
module will cause L<Try::Tiny> framework to be hidden in compliant stack
traces.
=head1 SEE ALSO
L<Sub::Uplevel> - Tool for hiding stack frames from all callers, not just stack
traces.
( run in 1.741 second using v1.01-cache-2.11-cpan-39bf76dae61 )