Trace::Mask::Util - Utilities for applying stack trace masks.
This package provides utilities to help you apply masks for stack traces. See Trace::Mask for the specification these utilities follow.
Note: All exports are optional, you must request them if you want them.
Update the mask for the specified $file, $line, and $sub. The mask hashref will be merged into any existing mask. You may use the wildcard string '*' for any 2 of the first 3 arguments. $sub may be coderef, or a fully qualified sub name.
$file
$line
$sub
'*'
This will check the mask to ensure it is valid. If the mask is valid an empty list is returned. If there are problems with the mask then a list of error strings will be returned.
Get the combined mask for the specific file, line and sub. This will be a merger of all applicable masks, including wildcards. $sub may be a coderef, or a fully qualified sub name.
This will call $sub with the specified mask and arguments. This will use goto &$sub to run your sun without mask_call() itself showing up in any stack frames. $sub can be a sub reference, or the name of a sub in the calling package.
goto &$sub
mask_call()
Apply the mask to the specified sub, which can be a coderef, or the name of a sub in the calling package. $file and $line are optional, '*' will be used if you do not specify.
This will mask calls on the current or current + $delta line of the calling package. Optionally uo can provide a list of subs to mask, '*' is used if none are specified.
$delta
This is useful if you wish to apply a mask to multiple calls on a specific line:
sub try(&) { my $code = shift; # Hides both the eval, and the anon-block call BEGIN { mask_line({hide => 1}, 1) } my $ok = eval { $code->(); 1 }; ... }
It is best to run this in a BEGIN {...} block so that the mask is added at compile time, instead of being re-added every time your code is run.
BEGIN {...}
This applies a mask to the currently running stack frame, that is whatever sub you use it in. This applies no matter where/how your sub was called.
The source code repository for Trace-Mask can be found at http://github.com/exodist/Trace-Mask.
Copyright 2015 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Trace::Mask, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Trace::Mask
CPAN shell
perl -MCPAN -e shell install Trace::Mask
For more information on module installation, please visit the detailed CPAN module installation guide.