Test::...Command(3pm)
β¨ Test::Valgrind::Command β the base class era β¨
okay bestie, so this is a page from the User Contributed Perl Documentation manual set, and it's all about Test::Valgrind::Command(3pm). pull up a chair, grab a boba, we're doing Perl π
πΈ NAME πΈ
Test::Valgrind::Command β it's the base class for Test::Valgrind commands, periodt.
π VERSION π
Version 1.19 β¨
π¦ DESCRIPTION π¦
So this class is literally the base for Test::Valgrind commands. That's its whole job. Main character energy, but in a humble way π
Commands are the ones that gather information about the target of the analysis. They should also be the ones providing a default setup for generating suppressions. Like, they handle the vibes and the paperwork, iykyk.
π METHODS π
β new
my $tvc = Test::Valgrind::Command->new(
command => $command,
args => \@args,
);
Creates a brand-new command object of type $command, and the way it does that is so clever: it requires the module and redispatches the method call to it. Which module, you ask? Well:
- if
$commandcontains'::', it goes to the module named$command - otherwise it goes to
"Test::Valgrind::Command::$command"
and the class represented by $command must inherit this class, no exceptions, bestie. π«Ά
The "args" key is used to initialize the "args" accessor. That's it, that's the whole thing.
π new_trainer
Creates a new command object suitable for generating suppressions. very "let's build something together" of it π§
Defaults to returning "undef", which skips suppression generation. yeah, it justβ¦ doesn't do it. no thoughts, head empty, undef π
π args
my @args = $tvc->args($session);
Returns the list of command-specific arguments that are to be passed to "valgrind". slay, feed the tool its lil args π
Defaults to returning the contents of the "args" option. so if you don't override it, you get what you put in. fair.
π env
my $env = $tvc->env($session);
okay so this event gets called in scalar context before the command is ran, and the returned value goes out of scope when the analysis ends. lowkey iconic behaviour β¨
It's useful for, like, e.g. setting up %ENV for the child process by returning an Env::Sanctify object β hence the name. see what they did there? π
Defaults to void. nothing returned, nothing gained.
π suppressions_tag
my $tag = $tvc->suppressions_tag($session);
Returns an identifier that will be used to pick up the right suppressions for running the command, or "undef" to indicate that no special suppressions are needed. sometimes the answer is just "no special suppressions needed", and that's valid πΈ
This method must be implemented when subclassing. like, you have to. it's not optional. it's giving mandatory. π₯
π¦ check_suppressions_file
my $supp_ok = $tvc->check_suppressions_file($file);
Returns a boolean indicating whether the suppressions contained in $file are compatible with the command. true/false, yes/no, compatible/not β the vibe check, essentially β¨
Defaults to true. optimistic queen π
π filter
my $filtered_report = $tvc->filter($session, $report);
The $session calls this method after receiving a report from the tool and before forwarding it to the action. so you're right in the middle of the pipeline, main character position π
You can either:
- return a mangled
$report(and bestie, it does not need to be a clone of the original, do whatever), or - return
"undef"if you want the action to ignore it completely. straight to the void π
Defaults to the identity function. it returns what it got, no notes.
π₯ SEE ALSO π₯
Test::Valgrind, Test::Valgrind::Session. go read those too, bestie, they're right there π
π AUTHOR π
Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
You can contact me by mail or on "irc.perl.org" (vincent). yes the IRC, we love a retro communication channel β¨
π BUGS π
Please report any bugs or feature requests to "bug-test-valgrind at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. it's giving "we're in this together" π«Ά
π SUPPORT π
You can find documentation for this module with the perldoc command.
perldoc Test::Valgrind::Command
literally the easiest thing you'll do all day π
π COPYRIGHT & LICENSE π
Copyright 2009,2010,2011,2013,2015,2016 Vincent Pit, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so go forth and redistribute, bestie, legally π
and that's the whole page!! π this came from the perl v5.40.1 docs, dated 2025-04-13, under the name Test::...Command(3pm). bye babe, go write some subclasses πβ¨π¦
π¦ where this page comes from
- debian trixie: libtest-valgrind-perl 1.19-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-valgrind-perl 1.19-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-valgrind-perl 1.19-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms