App::Prove(3perl)
π App::Prove β the whole entire vibe π
okay bestie, welcome to App::Prove, from the Perl Programmers Reference Guide. She's the module that is the prove command. Yes, THE prove. The one you've been typing at 2am. That one. π«Ά
VERSION: 3.52 β she's serving, she's current, she's iconic. β¨
πΈ NAME πΈ
App::Prove β literally implements the prove command. That's it, that's the whole job description. π
π¦ DESCRIPTION π¦
So Test::Harness gives us this command called prove, right? And prove runs a TAP-based test suite and then prints you a report like the little overachiever it is. π
And here's the tea: the prove command is basically a minimal wrapper around one single instance of this module. That's it. All that power, one lil object. main character energy fr fr. π
β¨ SYNOPSIS β¨
use App::Prove;
my $app = App::Prove->new;
$app->process_args(@ARGV);
$app->run;
three lines. that's the whole ritual. no cap. π₯
π METHODS π
π Class Methods π
newβ creates you a brand newApp::Prove. If you want, you can hand it a hash ref of attribute initializers and she'll take those too. so generous.state_classβ getter and setter for the name of the class that's used for maintaining state. This class should either subclass fromApp::Prove::State, or it should provide an identical interface. like, either be family or act exactly like family, yk? πstate_managerβ getter/setter for the actual instance of thestate_class. the manager of the state. the state of the manager. it's giving recursion but it's not. πadd_rc_fileβ
$prove->add_rc_file('myproj/.proverc');
you call this before process_args, and what it does is prepend the contents of an rc file onto the options. sneak preview but make it config. π
process_argsβ
$prove->process_args(@args);
this one processes the command-line arguments, and the attributes get set appropriately because of course they do, she's organized. any filenames she finds end up chilling in the argv attribute.
π¨ heads up bestie: on invalid arguments, this thing dies. literally. dies. so be normal with your args please. π
runβ performs whatever actions the command-line args told her to do. and this is what the actualprovecommand line tool looks like under the hood:
use App::Prove;
my $app = App::Prove->new;
$app->process_args(@ARGV);
exit( $app->run ? 0 : 1 ); # if you need the exit code
yes the comment in the code is right there, keep it, it's helpful. slay. π
require_harnessβ loads a harness replacement class, like so:
$prove->require_harness($for => $class_name);
print_versionβ shows you the version numbers of the loadedTAP::Harnessand the current Perl. two versions, one flex. β
π§ Attributes π§
After the command line has been parsed, all these attributes below reflect the values of the corresponding command line switches. and plot twist β you can still alter them before you call run. your call, your world. π
archiveargvbackwardsblibcolordirectivesdryexecextensionsfailurescommentsformatterharnessignore_exitincludesjobslibmergemodulesparsepluginsquietreally_quietrecurserulesshow_countshow_helpshow_manshow_versionshufflestatestate_classtaint_failtaint_warntest_argstimerverbosewarnings_failwarnings_warntapversiontrap
forty-ish of them. every single one accounted for. we don't skip here. π
π₯ PLUGINS π₯
App::Prove supports 3rd-party plugins, which is so generous of her honestly. But listen β these get loaded at run-time, after the arguments have been parsed. so you can not change the way arguments are processed. sorry bestie π that's just the deal.
Usually you load one with the -Pplugin switch, like:
prove -PMyPlugin
She'll go hunting for a module named App::Prove::Plugin::MyPlugin, and if that's not found, she tries MyPlugin instead. And if the plugin genuinely can't be found at all? prove will complain and exit. dramatic but fair. π
You can pass an argument to your plugin by sticking an = after the plugin name, like -PMyPlugin=foo. Want multiple args? commas, bestie:
prove -PMyPlugin=foo,bar,baz
All of those get passed into your plugin's load() class method (if it has one, no pressure), alongside a reference to the App::Prove object that's invoking your plugin:
sub load {
my ($class, $p) = @_;
my @args = @{ $p->{args} };
# @args will contain ( 'foo', 'bar', 'baz' )
$p->{app_prove}->do_something;
...
}
π Sample Plugin π
Here's a whole sample plugin for your reference, no gatekeeping here:
package App::Prove::Plugin::Foo;
# Sample plugin, try running with:
# prove -PFoo=bar -r -j3
# prove -PFoo -Q
# prove -PFoo=bar,My::Formatter
use strict;
use warnings;
sub load {
my ($class, $p) = @_;
my @args = @{ $p->{args} };
my $app = $p->{app_prove};
print "loading plugin: $class, args: ", join(', ', @args ), "\n";
# turn on verbosity
$app->verbose( 1 );
# set the formatter?
$app->formatter( $args[1] ) if @args > 1;
# print some of App::Prove's state:
for my $attr (qw( jobs quiet really_quiet recurse verbose )) {
my $val = $app->$attr;
$val = 'undef' unless defined( $val );
print "$attr: $val\n";
}
return 1;
}
1;
copy it, run it, love it. three whole invocations right there in the comments for you to try. you're welcome. π«Ά
π SEE ALSO π
proveTAP::Harness
okay that's the whole page bestie, you ate that. go forth and test. πβ¨
this has been App::Prove, page 3perl, in Perl v5.44.0, dated 2026-10-17. mwah. ππ¦πΈ
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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