1Trace::Mask::Util(3)  User Contributed Perl Documentation Trace::Mask::Util(3)
2
3
4

NAME

6       Trace::Mask::Util - Utilities for applying stack trace masks.
7

DESCRIPTION

9       This package provides utilities to help you apply masks for stack
10       traces. See Trace::Mask for the specification these utilities follow.
11
12   EXPORTS
13       Note: All exports are optional, you must request them if you want them.
14
15       update_mask($file, $line, $sub, \%mask)
16           Update the mask for the specified $file, $line, and $sub. The mask
17           hashref will be merged into any existing mask. You may use the
18           wildcard string '*' for any 2 of the first 3 arguments. $sub may be
19           coderef, or a fully qualified sub name.
20
21       @errors = validate_mask(\%mask)
22           This will check the mask to ensure it is valid. If the mask is
23           valid an empty list is returned. If there are problems with the
24           mask then a list of error strings will be returned.
25
26       $hr = get_mask($file, $line, $sub)
27           Get the combined mask for the specific file, line and sub. This
28           will be a merger of all applicable masks, including wildcards. $sub
29           may be a coderef, or a fully qualified sub name.
30
31       mask_call(\%mask, $sub)
32       mask_call(\%mask, $sub, @args)
33           This will call $sub with the specified mask and arguments. This
34           will use "goto &$sub" to run your sun without "mask_call()" itself
35           showing up in any stack frames. $sub can be a sub reference, or the
36           name of a sub in the calling package.
37
38       mask_sub(\%mask, $sub)
39       mask_sub(\%mask, $sub, $file)
40       mask_sub(\%mask, $sub, $file, $line)
41           Apply the mask to the specified sub, which can be a coderef, or the
42           name of a sub in the calling package. $file and $line are optional,
43           '*' will be used if you do not specify.
44
45       mask_line(\%mask)
46       mask_line(\%mask, $delta)
47       mask_line(\%mask, $delta, @subs)
48           This will mask calls on the current or current + $delta line of the
49           calling package. Optionally uo can provide a list of subs to mask,
50           '*' is used if none are specified.
51
52           This is useful if you wish to apply a mask to multiple calls on a
53           specific line:
54
55               sub try(&) {
56                   my $code = shift;
57
58                   # Hides both the eval, and the anon-block call
59                   BEGIN { mask_line({hide => 1}, 1) }
60                   my $ok = eval { $code->(); 1 };
61
62                   ...
63               }
64
65           It is best to run this in a "BEGIN {...}" block so that the mask is
66           added at compile time, instead of being re-added every time your
67           code is run.
68
69       mask_frame(%mask)
70           This applies a mask to the currently running stack frame, that is
71           whatever sub you use it in. This applies no matter where/how your
72           sub was called.
73

SOURCE

75       The source code repository for Trace-Mask can be found at
76       http://github.com/exodist/Trace-Mask.
77

MAINTAINERS

79       Chad Granum <exodist@cpan.org>
80

AUTHORS

82       Chad Granum <exodist@cpan.org>
83
85       Copyright 2015 Chad Granum <exodist7@gmail.com>.
86
87       This program is free software; you can redistribute it and/or modify it
88       under the same terms as Perl itself.
89
90       See http://www.perl.com/perl/misc/Artistic.html
91
92
93
94perl v5.32.1                      2021-01-27              Trace::Mask::Util(3)
Impressum