Test::TempDir(3pm)

Test::TempDir3pm

(deprecated) temporary files support for testing

Usage

    use Test::TempDir;
    my $test_tempdir = temp_root();
    my ( $fh, $file ) = tempfile();
    my $directory_scratch_obj = scratch();

Version

version 0.11

Deprecation notice

There have been numerous issues found with this module, particularly with its use of locks (unreliable, may result in your entire $TMPDIR being deleted) and MSWin32 compatibility. As well, it uses Moose, which is nowadays considered to be heavier than necessary.

Test::TempDir::Tiny was written as a replacement. Please use it instead!

Overview

Test::TempDir provides temporary directory creation with testing in mind.

The differences between using this and using File::Temp are:

•

If "t/tmp" is available (writable, creatable, etc) it's preferred over $ENV{TMPDIR} etc. Otherwise a temporary directory will be used.

This is "temp_root"

•

Lock files are used on "t/tmp", to prevent race conditions when running under a parallel test harness.

•

The "temp_root" is cleaned at the end of a test run, but not if tests failed.

•

"temp_root" is emptied at the beginning of a test run unconditionally.

•

The default policy is not to clean the individual "tempfiles" and "tempdirs" within "temp_root", in order to aid in debugging of failed tests.

Exports

"temp_root"

The root of the temporary stuff.

"tempfile"

"tempdir"

Wrappers for the File::Temp functions of the same name.

The default options are changed to use "temp_root" for "DIR" and disable "CLEANUP", but these are overridable.

"scratch"

Loads Directory::Scratch and instantiates a new one, with the same default options as "tempfile" and "tempdir".

Support

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-TempDir> (or [email protected] <mailto:[email protected]>).

There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/perl-qa.html>.

There is also an irc channel available for users of this distribution, at "#perl" on "irc.perl.org" <irc://irc.perl.org/#perl-qa>.

Contributors

•

Karen Etheridge <[email protected]>

•

Florian Ragwitz <[email protected]>

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 4 times.

  1. 6.0–7
  2. 8
  3. 9–10
  4. 11
  5. 12–13

Author

XXXX XXX'XX (Yuval Kogman) <[email protected]>

From libtest-tempdir-perl 0.11-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.