Trace::Mask::Carp(3)
π Trace::Mask::Carp β the manual, but make it make sense
okay bestie, welcome to the Trace::Mask::Carp page π this is a User Contributed Perl Documentation situation, and it's about the module Trace::Mask::Carp. buckle up, it's actually so good.
β¨ NAME β¨
Trace::Mask::Carp β the Trace::Mask tools for masking Carp traces, no cap π
πΈ DESCRIPTION πΈ
so like, this module lets you apply Trace::Mask behavior to traces coming out of the Carp module. that's it. that's the whole vibe. π¦
π SYNOPSIS π
π LEXICAL π
okay so you can import confess(), cluck(), and longmess() straight from this module, and that will mask traces produced from these functions in your module β but it will not effect any other modules' traces. this is the safest way to use this module, periodt. π₯
use Trace::Mask::Carp qw/confess cluck longmess mask/;
...
confess "XXX"; # throws an exception with a masked trace
# Any traces produced inside the block below, regardless of what module
# calls confess/cluck/longmess, will be masked.
mask {
...
};
π HANDLERS π
THIS HAS GLOBAL CONSEQUENCES!!! π
this one drops handlers into $SIG{__WARN__} and $SIG{__DIE__} that will mask Carp traces no matter where they are generated. like, everywhere. it's giving main character energy but for your whole process.
use Trace::Mask::Carp '-global'
Note: this is useful in a test, script, app, psgi file, etc, but should NEVER be used by a cpan module or library. i said what i said. π
π OVERRIDE π
THIS HAS GLOBAL CONSEQUENCES!!! π
this one straight up redefines confess(), cluck(), and longmess() inside Carp itself. so any modules that import these functions from Carp will get the masked versions instead. lowkey unhinged. highkey iconic.
important caveat though: this will not effect already loaded modules! π«Ά
use Trace::Mask::Carp '-wrap'
Note: this is useful in a test, script, app, psgi file, etc, but should NEVER be used by a cpan module or library. same energy as before, bestie. π
β IMPORT OPTIONS β
π FLAGS π
-globalβ adds global handlers to$SIG{__WARN__}and$SIG{__DIE__}that mask traces coming fromcarp. yes, globally. yes, everywhere. π-wrapβ modifieslongmess(),confess(), andcluck()in Carp itself so that any modules that loadcarpwill get the mask versions. this will nto effect any modules that have already loadedcarp. (that typo is in the original, i'm just the messenger π)
π§ EXPORTS π§
Note: all exports are optional, you must request them if you want them. no surprise gifts here. π
$trace_string = longmess($message)confess($error)cluck($warning)
these are basically wrappers around the Carp functions of the same name, bestie. they get the trace from Carp, then mask it. slay. π
mask { ... }β this sets$SIG{__WARN__}and$SIG{__DIE__}for the code inside the block. so traces generated inside the mask block get masked, but traces outside the block are not effected. boundaries, we love them. β¨$hr = parse_carp_line($line)β returns a hashref with all the info you can gather from that one line of carp output. typically that includes the file and line number. it may also include an error message or a subroutine name, plus any arguments that were passed into the sub when it was called. detective work fr fr π$masked_trace = mask_trace($trace)$masked_trace = mask_trace($trace, $subname)
$subname should typically be 'confess', 'longmess', or 'cluck', but it's also optional. this takes a trace from Carp (string form) and hands you back the masked form. glow-up complete. π
π₯ SOURCE π₯
the source code repository for Trace-Mask can be found at http://github.com/exodist/Trace-Mask. go peek, it's right there. π«Ά
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π AUTHORS π
Chad Granum <exodist@cpan.org>
π COPYRIGHT π
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
and that's the whole page, bestie π this was Trace::Mask::Carp(3) from perl v5.42.0, dated 2025-07-25 β go mask some traces, you absolute icon πβ¨
π¦ where this page comes from
- fedora 43: perl-Trace-Mask 0.000008-27.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms