| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "App::Prove 3perl" |
| 58 |
.TH App::Prove 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
App::Prove \- Implements the "prove" command. |
| 65 |
.SH VERSION |
| 66 |
.IX Header "VERSION" |
| 67 |
Version 3.48 |
| 68 |
.SH DESCRIPTION |
| 69 |
.IX Header "DESCRIPTION" |
| 70 |
Test::Harness provides a command, \f(CW\*(C`prove\*(C'\fR, which runs a TAP based |
| 71 |
test suite and prints a report. The \f(CW\*(C`prove\*(C'\fR command is a minimal |
| 72 |
wrapper around an instance of this module. |
| 73 |
.SH SYNOPSIS |
| 74 |
.IX Header "SYNOPSIS" |
| 75 |
.Vb 1 |
| 76 |
\& use App::Prove; |
| 77 |
\& |
| 78 |
\& my $app = App::Prove\->new; |
| 79 |
\& $app\->process_args(@ARGV); |
| 80 |
\& $app\->run; |
| 81 |
.Ve |
| 82 |
.SH METHODS |
| 83 |
.IX Header "METHODS" |
| 84 |
.SS "Class Methods" |
| 85 |
.IX Subsection "Class Methods" |
| 86 |
\fR\f(CI\*(C`new\*(C'\fR\fI\fR |
| 87 |
.IX Subsection "new" |
| 88 |
.PP |
| 89 |
Create a new \f(CW\*(C`App::Prove\*(C'\fR. Optionally a hash ref of attribute |
| 90 |
initializers may be passed. |
| 91 |
.PP |
| 92 |
\fR\f(CI\*(C`state_class\*(C'\fR\fI\fR |
| 93 |
.IX Subsection "state_class" |
| 94 |
.PP |
| 95 |
Getter/setter for the name of the class used for maintaining state. This |
| 96 |
class should either subclass from \f(CW\*(C`App::Prove::State\*(C'\fR or provide an identical |
| 97 |
interface. |
| 98 |
.PP |
| 99 |
\fR\f(CI\*(C`state_manager\*(C'\fR\fI\fR |
| 100 |
.IX Subsection "state_manager" |
| 101 |
.PP |
| 102 |
Getter/setter for the instance of the \f(CW\*(C`state_class\*(C'\fR. |
| 103 |
.PP |
| 104 |
\fR\f(CI\*(C`add_rc_file\*(C'\fR\fI\fR |
| 105 |
.IX Subsection "add_rc_file" |
| 106 |
.PP |
| 107 |
.Vb 1 |
| 108 |
\& $prove\->add_rc_file(\*(Aqmyproj/.proverc\*(Aq); |
| 109 |
.Ve |
| 110 |
.PP |
| 111 |
Called before \f(CW\*(C`process_args\*(C'\fR to prepend the contents of an rc file to |
| 112 |
the options. |
| 113 |
.PP |
| 114 |
\fR\f(CI\*(C`process_args\*(C'\fR\fI\fR |
| 115 |
.IX Subsection "process_args" |
| 116 |
.PP |
| 117 |
.Vb 1 |
| 118 |
\& $prove\->process_args(@args); |
| 119 |
.Ve |
| 120 |
.PP |
| 121 |
Processes the command-line arguments. Attributes will be set |
| 122 |
appropriately. Any filenames may be found in the \f(CW\*(C`argv\*(C'\fR attribute. |
| 123 |
.PP |
| 124 |
Dies on invalid arguments. |
| 125 |
.PP |
| 126 |
\fR\f(CI\*(C`run\*(C'\fR\fI\fR |
| 127 |
.IX Subsection "run" |
| 128 |
.PP |
| 129 |
Perform whatever actions the command line args specified. The \f(CW\*(C`prove\*(C'\fR |
| 130 |
command line tool consists of the following code: |
| 131 |
.PP |
| 132 |
.Vb 1 |
| 133 |
\& use App::Prove; |
| 134 |
\& |
| 135 |
\& my $app = App::Prove\->new; |
| 136 |
\& $app\->process_args(@ARGV); |
| 137 |
\& exit( $app\->run ? 0 : 1 ); # if you need the exit code |
| 138 |
.Ve |
| 139 |
.PP |
| 140 |
\fR\f(CI\*(C`require_harness\*(C'\fR\fI\fR |
| 141 |
.IX Subsection "require_harness" |
| 142 |
.PP |
| 143 |
Load a harness replacement class. |
| 144 |
.PP |
| 145 |
.Vb 1 |
| 146 |
\& $prove\->require_harness($for => $class_name); |
| 147 |
.Ve |
| 148 |
.PP |
| 149 |
\fR\f(CI\*(C`print_version\*(C'\fR\fI\fR |
| 150 |
.IX Subsection "print_version" |
| 151 |
.PP |
| 152 |
Display the version numbers of the loaded TAP::Harness and the |
| 153 |
current Perl. |
| 154 |
.SS Attributes |
| 155 |
.IX Subsection "Attributes" |
| 156 |
After command line parsing the following attributes reflect the values |
| 157 |
of the corresponding command line switches. They may be altered before |
| 158 |
calling \f(CW\*(C`run\*(C'\fR. |
| 159 |
.ie n .IP """archive""" 4 |
| 160 |
.el .IP \f(CWarchive\fR 4 |
| 161 |
.IX Item "archive" |
| 162 |
.PD 0 |
| 163 |
.ie n .IP """argv""" 4 |
| 164 |
.el .IP \f(CWargv\fR 4 |
| 165 |
.IX Item "argv" |
| 166 |
.ie n .IP """backwards""" 4 |
| 167 |
.el .IP \f(CWbackwards\fR 4 |
| 168 |
.IX Item "backwards" |
| 169 |
.ie n .IP """blib""" 4 |
| 170 |
.el .IP \f(CWblib\fR 4 |
| 171 |
.IX Item "blib" |
| 172 |
.ie n .IP """color""" 4 |
| 173 |
.el .IP \f(CWcolor\fR 4 |
| 174 |
.IX Item "color" |
| 175 |
.ie n .IP """directives""" 4 |
| 176 |
.el .IP \f(CWdirectives\fR 4 |
| 177 |
.IX Item "directives" |
| 178 |
.ie n .IP """dry""" 4 |
| 179 |
.el .IP \f(CWdry\fR 4 |
| 180 |
.IX Item "dry" |
| 181 |
.ie n .IP """exec""" 4 |
| 182 |
.el .IP \f(CWexec\fR 4 |
| 183 |
.IX Item "exec" |
| 184 |
.ie n .IP """extensions""" 4 |
| 185 |
.el .IP \f(CWextensions\fR 4 |
| 186 |
.IX Item "extensions" |
| 187 |
.ie n .IP """failures""" 4 |
| 188 |
.el .IP \f(CWfailures\fR 4 |
| 189 |
.IX Item "failures" |
| 190 |
.ie n .IP """comments""" 4 |
| 191 |
.el .IP \f(CWcomments\fR 4 |
| 192 |
.IX Item "comments" |
| 193 |
.ie n .IP """formatter""" 4 |
| 194 |
.el .IP \f(CWformatter\fR 4 |
| 195 |
.IX Item "formatter" |
| 196 |
.ie n .IP """harness""" 4 |
| 197 |
.el .IP \f(CWharness\fR 4 |
| 198 |
.IX Item "harness" |
| 199 |
.ie n .IP """ignore_exit""" 4 |
| 200 |
.el .IP \f(CWignore_exit\fR 4 |
| 201 |
.IX Item "ignore_exit" |
| 202 |
.ie n .IP """includes""" 4 |
| 203 |
.el .IP \f(CWincludes\fR 4 |
| 204 |
.IX Item "includes" |
| 205 |
.ie n .IP """jobs""" 4 |
| 206 |
.el .IP \f(CWjobs\fR 4 |
| 207 |
.IX Item "jobs" |
| 208 |
.ie n .IP """lib""" 4 |
| 209 |
.el .IP \f(CWlib\fR 4 |
| 210 |
.IX Item "lib" |
| 211 |
.ie n .IP """merge""" 4 |
| 212 |
.el .IP \f(CWmerge\fR 4 |
| 213 |
.IX Item "merge" |
| 214 |
.ie n .IP """modules""" 4 |
| 215 |
.el .IP \f(CWmodules\fR 4 |
| 216 |
.IX Item "modules" |
| 217 |
.ie n .IP """parse""" 4 |
| 218 |
.el .IP \f(CWparse\fR 4 |
| 219 |
.IX Item "parse" |
| 220 |
.ie n .IP """plugins""" 4 |
| 221 |
.el .IP \f(CWplugins\fR 4 |
| 222 |
.IX Item "plugins" |
| 223 |
.ie n .IP """quiet""" 4 |
| 224 |
.el .IP \f(CWquiet\fR 4 |
| 225 |
.IX Item "quiet" |
| 226 |
.ie n .IP """really_quiet""" 4 |
| 227 |
.el .IP \f(CWreally_quiet\fR 4 |
| 228 |
.IX Item "really_quiet" |
| 229 |
.ie n .IP """recurse""" 4 |
| 230 |
.el .IP \f(CWrecurse\fR 4 |
| 231 |
.IX Item "recurse" |
| 232 |
.ie n .IP """rules""" 4 |
| 233 |
.el .IP \f(CWrules\fR 4 |
| 234 |
.IX Item "rules" |
| 235 |
.ie n .IP """show_count""" 4 |
| 236 |
.el .IP \f(CWshow_count\fR 4 |
| 237 |
.IX Item "show_count" |
| 238 |
.ie n .IP """show_help""" 4 |
| 239 |
.el .IP \f(CWshow_help\fR 4 |
| 240 |
.IX Item "show_help" |
| 241 |
.ie n .IP """show_man""" 4 |
| 242 |
.el .IP \f(CWshow_man\fR 4 |
| 243 |
.IX Item "show_man" |
| 244 |
.ie n .IP """show_version""" 4 |
| 245 |
.el .IP \f(CWshow_version\fR 4 |
| 246 |
.IX Item "show_version" |
| 247 |
.ie n .IP """shuffle""" 4 |
| 248 |
.el .IP \f(CWshuffle\fR 4 |
| 249 |
.IX Item "shuffle" |
| 250 |
.ie n .IP """state""" 4 |
| 251 |
.el .IP \f(CWstate\fR 4 |
| 252 |
.IX Item "state" |
| 253 |
.ie n .IP """state_class""" 4 |
| 254 |
.el .IP \f(CWstate_class\fR 4 |
| 255 |
.IX Item "state_class" |
| 256 |
.ie n .IP """taint_fail""" 4 |
| 257 |
.el .IP \f(CWtaint_fail\fR 4 |
| 258 |
.IX Item "taint_fail" |
| 259 |
.ie n .IP """taint_warn""" 4 |
| 260 |
.el .IP \f(CWtaint_warn\fR 4 |
| 261 |
.IX Item "taint_warn" |
| 262 |
.ie n .IP """test_args""" 4 |
| 263 |
.el .IP \f(CWtest_args\fR 4 |
| 264 |
.IX Item "test_args" |
| 265 |
.ie n .IP """timer""" 4 |
| 266 |
.el .IP \f(CWtimer\fR 4 |
| 267 |
.IX Item "timer" |
| 268 |
.ie n .IP """verbose""" 4 |
| 269 |
.el .IP \f(CWverbose\fR 4 |
| 270 |
.IX Item "verbose" |
| 271 |
.ie n .IP """warnings_fail""" 4 |
| 272 |
.el .IP \f(CWwarnings_fail\fR 4 |
| 273 |
.IX Item "warnings_fail" |
| 274 |
.ie n .IP """warnings_warn""" 4 |
| 275 |
.el .IP \f(CWwarnings_warn\fR 4 |
| 276 |
.IX Item "warnings_warn" |
| 277 |
.ie n .IP """tapversion""" 4 |
| 278 |
.el .IP \f(CWtapversion\fR 4 |
| 279 |
.IX Item "tapversion" |
| 280 |
.ie n .IP """trap""" 4 |
| 281 |
.el .IP \f(CWtrap\fR 4 |
| 282 |
.IX Item "trap" |
| 283 |
.PD |
| 284 |
.SH PLUGINS |
| 285 |
.IX Header "PLUGINS" |
| 286 |
\&\f(CW\*(C`App::Prove\*(C'\fR provides support for 3rd\-party plugins. These are currently |
| 287 |
loaded at run-time, \fIafter\fR arguments have been parsed (so you can not |
| 288 |
change the way arguments are processed, sorry), typically with the |
| 289 |
\&\f(CW\*(C`\-P\fR\f(CIplugin\fR\f(CW\*(C'\fR switch, eg: |
| 290 |
.PP |
| 291 |
.Vb 1 |
| 292 |
\& prove \-PMyPlugin |
| 293 |
.Ve |
| 294 |
.PP |
| 295 |
This will search for a module named \f(CW\*(C`App::Prove::Plugin::MyPlugin\*(C'\fR, or failing |
| 296 |
that, \f(CW\*(C`MyPlugin\*(C'\fR. If the plugin can't be found, \f(CW\*(C`prove\*(C'\fR will complain & exit. |
| 297 |
.PP |
| 298 |
You can pass an argument to your plugin by appending an \f(CW\*(C`=\*(C'\fR after the plugin |
| 299 |
name, eg \f(CW\*(C`\-PMyPlugin=foo\*(C'\fR. You can pass multiple arguments using commas: |
| 300 |
.PP |
| 301 |
.Vb 1 |
| 302 |
\& prove \-PMyPlugin=foo,bar,baz |
| 303 |
.Ve |
| 304 |
.PP |
| 305 |
These are passed in to your plugin's \f(CWload()\fR class method (if it has one), |
| 306 |
along with a reference to the \f(CW\*(C`App::Prove\*(C'\fR object that is invoking your plugin: |
| 307 |
.PP |
| 308 |
.Vb 2 |
| 309 |
\& sub load { |
| 310 |
\& my ($class, $p) = @_; |
| 311 |
\& |
| 312 |
\& my @args = @{ $p\->{args} }; |
| 313 |
\& # @args will contain ( \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq ) |
| 314 |
\& $p\->{app_prove}\->do_something; |
| 315 |
\& ... |
| 316 |
\& } |
| 317 |
.Ve |
| 318 |
.SS "Sample Plugin" |
| 319 |
.IX Subsection "Sample Plugin" |
| 320 |
Here's a sample plugin, for your reference: |
| 321 |
.PP |
| 322 |
.Vb 1 |
| 323 |
\& package App::Prove::Plugin::Foo; |
| 324 |
\& |
| 325 |
\& # Sample plugin, try running with: |
| 326 |
\& # prove \-PFoo=bar \-r \-j3 |
| 327 |
\& # prove \-PFoo \-Q |
| 328 |
\& # prove \-PFoo=bar,My::Formatter |
| 329 |
\& |
| 330 |
\& use strict; |
| 331 |
\& use warnings; |
| 332 |
\& |
| 333 |
\& sub load { |
| 334 |
\& my ($class, $p) = @_; |
| 335 |
\& my @args = @{ $p\->{args} }; |
| 336 |
\& my $app = $p\->{app_prove}; |
| 337 |
\& |
| 338 |
\& print "loading plugin: $class, args: ", join(\*(Aq, \*(Aq, @args ), "\en"; |
| 339 |
\& |
| 340 |
\& # turn on verbosity |
| 341 |
\& $app\->verbose( 1 ); |
| 342 |
\& |
| 343 |
\& # set the formatter? |
| 344 |
\& $app\->formatter( $args[1] ) if @args > 1; |
| 345 |
\& |
| 346 |
\& # print some of App::Prove\*(Aqs state: |
| 347 |
\& for my $attr (qw( jobs quiet really_quiet recurse verbose )) { |
| 348 |
\& my $val = $app\->$attr; |
| 349 |
\& $val = \*(Aqundef\*(Aq unless defined( $val ); |
| 350 |
\& print "$attr: $val\en"; |
| 351 |
\& } |
| 352 |
\& |
| 353 |
\& return 1; |
| 354 |
\& } |
| 355 |
\& |
| 356 |
\& 1; |
| 357 |
.Ve |
| 358 |
.SH "SEE ALSO" |
| 359 |
.IX Header "SEE ALSO" |
| 360 |
prove, TAP::Harness |