.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "App::Prove 3perl" .TH App::Prove 3perl "2021-09-24" "perl v5.32.1" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" App::Prove \- Implements the "prove" command. .SH "VERSION" .IX Header "VERSION" Version 3.42 .SH "DESCRIPTION" .IX Header "DESCRIPTION" Test::Harness provides a command, \f(CW\*(C`prove\*(C'\fR, which runs a \s-1TAP\s0 based test suite and prints a report. The \f(CW\*(C`prove\*(C'\fR command is a minimal wrapper around an instance of this module. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use App::Prove; \& \& my $app = App::Prove\->new; \& $app\->process_args(@ARGV); \& $app\->run; .Ve .SH "METHODS" .IX Header "METHODS" .SS "Class Methods" .IX Subsection "Class Methods" \fI\f(CI\*(C`new\*(C'\fI\fR .IX Subsection "new" .PP Create a new \f(CW\*(C`App::Prove\*(C'\fR. Optionally a hash ref of attribute initializers may be passed. .PP \fI\f(CI\*(C`state_class\*(C'\fI\fR .IX Subsection "state_class" .PP Getter/setter for the name of the class used for maintaining state. This class should either subclass from \f(CW\*(C`App::Prove::State\*(C'\fR or provide an identical interface. .PP \fI\f(CI\*(C`state_manager\*(C'\fI\fR .IX Subsection "state_manager" .PP Getter/setter for the instance of the \f(CW\*(C`state_class\*(C'\fR. .PP \fI\f(CI\*(C`add_rc_file\*(C'\fI\fR .IX Subsection "add_rc_file" .PP .Vb 1 \& $prove\->add_rc_file(\*(Aqmyproj/.proverc\*(Aq); .Ve .PP Called before \f(CW\*(C`process_args\*(C'\fR to prepend the contents of an rc file to the options. .PP \fI\f(CI\*(C`process_args\*(C'\fI\fR .IX Subsection "process_args" .PP .Vb 1 \& $prove\->process_args(@args); .Ve .PP Processes the command-line arguments. Attributes will be set appropriately. Any filenames may be found in the \f(CW\*(C`argv\*(C'\fR attribute. .PP Dies on invalid arguments. .PP \fI\f(CI\*(C`run\*(C'\fI\fR .IX Subsection "run" .PP Perform whatever actions the command line args specified. The \f(CW\*(C`prove\*(C'\fR command line tool consists of the following code: .PP .Vb 1 \& use App::Prove; \& \& my $app = App::Prove\->new; \& $app\->process_args(@ARGV); \& exit( $app\->run ? 0 : 1 ); # if you need the exit code .Ve .PP \fI\f(CI\*(C`require_harness\*(C'\fI\fR .IX Subsection "require_harness" .PP Load a harness replacement class. .PP .Vb 1 \& $prove\->require_harness($for => $class_name); .Ve .PP \fI\f(CI\*(C`print_version\*(C'\fI\fR .IX Subsection "print_version" .PP Display the version numbers of the loaded TAP::Harness and the current Perl. .SS "Attributes" .IX Subsection "Attributes" After command line parsing the following attributes reflect the values of the corresponding command line switches. They may be altered before calling \f(CW\*(C`run\*(C'\fR. .ie n .IP """archive""" 4 .el .IP "\f(CWarchive\fR" 4 .IX Item "archive" .PD 0 .ie n .IP """argv""" 4 .el .IP "\f(CWargv\fR" 4 .IX Item "argv" .ie n .IP """backwards""" 4 .el .IP "\f(CWbackwards\fR" 4 .IX Item "backwards" .ie n .IP """blib""" 4 .el .IP "\f(CWblib\fR" 4 .IX Item "blib" .ie n .IP """color""" 4 .el .IP "\f(CWcolor\fR" 4 .IX Item "color" .ie n .IP """directives""" 4 .el .IP "\f(CWdirectives\fR" 4 .IX Item "directives" .ie n .IP """dry""" 4 .el .IP "\f(CWdry\fR" 4 .IX Item "dry" .ie n .IP """exec""" 4 .el .IP "\f(CWexec\fR" 4 .IX Item "exec" .ie n .IP """extensions""" 4 .el .IP "\f(CWextensions\fR" 4 .IX Item "extensions" .ie n .IP """failures""" 4 .el .IP "\f(CWfailures\fR" 4 .IX Item "failures" .ie n .IP """comments""" 4 .el .IP "\f(CWcomments\fR" 4 .IX Item "comments" .ie n .IP """formatter""" 4 .el .IP "\f(CWformatter\fR" 4 .IX Item "formatter" .ie n .IP """harness""" 4 .el .IP "\f(CWharness\fR" 4 .IX Item "harness" .ie n .IP """ignore_exit""" 4 .el .IP "\f(CWignore_exit\fR" 4 .IX Item "ignore_exit" .ie n .IP """includes""" 4 .el .IP "\f(CWincludes\fR" 4 .IX Item "includes" .ie n .IP """jobs""" 4 .el .IP "\f(CWjobs\fR" 4 .IX Item "jobs" .ie n .IP """lib""" 4 .el .IP "\f(CWlib\fR" 4 .IX Item "lib" .ie n .IP """merge""" 4 .el .IP "\f(CWmerge\fR" 4 .IX Item "merge" .ie n .IP """modules""" 4 .el .IP "\f(CWmodules\fR" 4 .IX Item "modules" .ie n .IP """parse""" 4 .el .IP "\f(CWparse\fR" 4 .IX Item "parse" .ie n .IP """plugins""" 4 .el .IP "\f(CWplugins\fR" 4 .IX Item "plugins" .ie n .IP """quiet""" 4 .el .IP "\f(CWquiet\fR" 4 .IX Item "quiet" .ie n .IP """really_quiet""" 4 .el .IP "\f(CWreally_quiet\fR" 4 .IX Item "really_quiet" .ie n .IP """recurse""" 4 .el .IP "\f(CWrecurse\fR" 4 .IX Item "recurse" .ie n .IP """rules""" 4 .el .IP "\f(CWrules\fR" 4 .IX Item "rules" .ie n .IP """show_count""" 4 .el .IP "\f(CWshow_count\fR" 4 .IX Item "show_count" .ie n .IP """show_help""" 4 .el .IP "\f(CWshow_help\fR" 4 .IX Item "show_help" .ie n .IP """show_man""" 4 .el .IP "\f(CWshow_man\fR" 4 .IX Item "show_man" .ie n .IP """show_version""" 4 .el .IP "\f(CWshow_version\fR" 4 .IX Item "show_version" .ie n .IP """shuffle""" 4 .el .IP "\f(CWshuffle\fR" 4 .IX Item "shuffle" .ie n .IP """state""" 4 .el .IP "\f(CWstate\fR" 4 .IX Item "state" .ie n .IP """state_class""" 4 .el .IP "\f(CWstate_class\fR" 4 .IX Item "state_class" .ie n .IP """taint_fail""" 4 .el .IP "\f(CWtaint_fail\fR" 4 .IX Item "taint_fail" .ie n .IP """taint_warn""" 4 .el .IP "\f(CWtaint_warn\fR" 4 .IX Item "taint_warn" .ie n .IP """test_args""" 4 .el .IP "\f(CWtest_args\fR" 4 .IX Item "test_args" .ie n .IP """timer""" 4 .el .IP "\f(CWtimer\fR" 4 .IX Item "timer" .ie n .IP """verbose""" 4 .el .IP "\f(CWverbose\fR" 4 .IX Item "verbose" .ie n .IP """warnings_fail""" 4 .el .IP "\f(CWwarnings_fail\fR" 4 .IX Item "warnings_fail" .ie n .IP """warnings_warn""" 4 .el .IP "\f(CWwarnings_warn\fR" 4 .IX Item "warnings_warn" .ie n .IP """tapversion""" 4 .el .IP "\f(CWtapversion\fR" 4 .IX Item "tapversion" .ie n .IP """trap""" 4 .el .IP "\f(CWtrap\fR" 4 .IX Item "trap" .PD .SH "PLUGINS" .IX Header "PLUGINS" \&\f(CW\*(C`App::Prove\*(C'\fR provides support for 3rd\-party plugins. These are currently loaded at run-time, \fIafter\fR arguments have been parsed (so you can not change the way arguments are processed, sorry), typically with the \&\f(CW\*(C`\-P\f(CIplugin\f(CW\*(C'\fR switch, eg: .PP .Vb 1 \& prove \-PMyPlugin .Ve .PP This will search for a module named \f(CW\*(C`App::Prove::Plugin::MyPlugin\*(C'\fR, or failing that, \f(CW\*(C`MyPlugin\*(C'\fR. If the plugin can't be found, \f(CW\*(C`prove\*(C'\fR will complain & exit. .PP You can pass an argument to your plugin by appending an \f(CW\*(C`=\*(C'\fR after the plugin name, eg \f(CW\*(C`\-PMyPlugin=foo\*(C'\fR. You can pass multiple arguments using commas: .PP .Vb 1 \& prove \-PMyPlugin=foo,bar,baz .Ve .PP These are passed in to your plugin's \f(CW\*(C`load()\*(C'\fR class method (if it has one), along with a reference to the \f(CW\*(C`App::Prove\*(C'\fR object that is invoking your plugin: .PP .Vb 2 \& sub load { \& my ($class, $p) = @_; \& \& my @args = @{ $p\->{args} }; \& # @args will contain ( \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq ) \& $p\->{app_prove}\->do_something; \& ... \& } .Ve .PP Note that the user's arguments are also passed to your plugin's \f(CW\*(C`import()\*(C'\fR function as a list, eg: .PP .Vb 5 \& sub import { \& my ($class, @args) = @_; \& # @args will contain ( \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq ) \& ... \& } .Ve .PP This is for backwards compatibility, and may be deprecated in the future. .SS "Sample Plugin" .IX Subsection "Sample Plugin" Here's a sample plugin, for your reference: .PP .Vb 1 \& 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(\*(Aq, \*(Aq, @args ), "\en"; \& \& # turn on verbosity \& $app\->verbose( 1 ); \& \& # set the formatter? \& $app\->formatter( $args[1] ) if @args > 1; \& \& # print some of App::Prove\*(Aqs state: \& for my $attr (qw( jobs quiet really_quiet recurse verbose )) { \& my $val = $app\->$attr; \& $val = \*(Aqundef\*(Aq unless defined( $val ); \& print "$attr: $val\en"; \& } \& \& return 1; \& } \& \& 1; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" prove, TAP::Harness