Test::Run::Core - Base class to run standard TAP scripts.


Version 0.0305


For Moose.


See Test::Run::Base::PlugHelpers.

Object Parameters

These parameters are accessors. They can be set at object creation by passing their name along with a value on the constructor (along with the compulsory 'test_files' argument):

    my $tester = Test::Run::Obj->new(
            'test_files' => \@mytests,
            'Verbose' => 1,

Alternatively, before runtests() is called, they can be set by passing a value to their accessor:


The object variable $self->Verbose() can be used to let runtests() display the standard output of the script without altering the behavior otherwise. The runprove utility's -v flag will set this.


When set to the name of a directory, $tester will check after each test whether new files appeared in that directory, and report them as

  LEAKED FILES: scr.tmp 0 my.db

If relative, directory name is with respect to the current directory at the moment $tester->runtests() was called. Putting the absolute path into Leaked_Dir will give more predictable results.


If $self->Debug() is true, Test::Run will print debugging information about itself as it runs the tests. This is different from $self->Verbose(), which prints the output from the test being run.


This value will be used for the width of the terminal. If it is not set then it will default to 80.


If set to true, and Time::HiRes is available, print elapsed seconds after each test file.


When set to a true value, forces it to behave as though STDOUT were not a console. You may need to set this if you don't want harness to output more frequent progress messages using carriage returns. Some consoles may not handle carriage returns properly (which results in a somewhat messy output).


Usually your tests will be run by $^X, the currently-executing Perl. However, you may want to have it run by a different executable, such as a threading perl, or a different version.

$self->Switches() and $self->Switches_Env()

These two values will be prepended to the switches used to invoke perl on each test. For example, setting one of them to -W will run all tests with all warnings enabled.

The difference between them is that Switches_Env() is expected to be filled in by the environment and Switches() from other sources (like the programmer).


Test::Run currently has only one interface method.


    my $all_ok = $tester->runtests()

Runs the tests, see if they are OK. Returns true if they are OK, or throw an exception otherwise.

$self->_report_leaked_files({leaked_files => [@files]})

[This is a method that needs to be over-rided.]

Should report (or ignore) the files that were leaked in the directories that were specifies as leaking directories.


[This is a method that needs to be over-rided.]

Should report (or ignore) the failed tests in the test file.

Arguments are:

  • test_struct

    The test struct as returned by straps.

  • filename

    The filename

  • estatus

    Exit status.

  • wstatus

    Wait status.

  • results

    The results of the test.


Called to recheck that the dir files is OK.