Test::TempDir(3pm) User Contributed Perl Documentation Test::TempDir(3pm)

Test::TempDir - (DEPRECATED) Temporary files support for testing

version 0.11

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!

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

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

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

The root of the temporary stuff.

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.

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

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

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>.

XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org>

This software is copyright (c) 2006 by XXXX XXX'XX (Yuval Kogman).

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2022-07-11 perl v5.34.0