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 new App::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 from App::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 the state_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 actual prove command 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 loaded TAP::Harness and 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. 🌈

  • archive
  • argv
  • backwards
  • blib
  • color
  • directives
  • dry
  • exec
  • extensions
  • failures
  • comments
  • formatter
  • harness
  • ignore_exit
  • includes
  • jobs
  • lib
  • merge
  • modules
  • parse
  • plugins
  • quiet
  • really_quiet
  • recurse
  • rules
  • show_count
  • show_help
  • show_man
  • show_version
  • shuffle
  • state
  • state_class
  • taint_fail
  • taint_warn
  • test_args
  • timer
  • verbose
  • warnings_fail
  • warnings_warn
  • tapversion
  • trap

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 πŸ‘‘

  • prove
  • TAP::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