1Test::TempDir(3) User Contributed Perl Documentation Test::TempDir(3)
2
3
4
6 Test::TempDir - (DEPRECATED) Temporary files support for testing
7
9 version 0.11
10
12 There have been numerous issues found with this module, particularly
13 with its use of locks (unreliable, may result in your entire $TMPDIR
14 being deleted) and MSWin32 compatibility. As well, it uses Moose, which
15 is nowadays considered to be heavier than necessary.
16
17 Test::TempDir::Tiny was written as a replacement. Please use it
18 instead!
19
21 use Test::TempDir;
22
23 my $test_tempdir = temp_root();
24
25 my ( $fh, $file ) = tempfile();
26
27 my $directory_scratch_obj = scratch();
28
30 Test::TempDir provides temporary directory creation with testing in
31 mind.
32
33 The differences between using this and using File::Temp are:
34
35 •
36
37
38 If "t/tmp" is available (writable, creatable, etc) it's preferred
39 over $ENV{TMPDIR} etc. Otherwise a temporary directory will be
40 used.
41
42 This is "temp_root"
43
44 • Lock files are used on "t/tmp", to prevent race conditions when
45 running under a parallel test harness.
46
47 • The "temp_root" is cleaned at the end of a test run, but not if
48 tests failed.
49
50 • "temp_root" is emptied at the beginning of a test run
51 unconditionally.
52
53 • The default policy is not to clean the individual "tempfiles" and
54 "tempdirs" within "temp_root", in order to aid in debugging of
55 failed tests.
56
58 "temp_root"
59 The root of the temporary stuff.
60
61 "tempfile"
62 "tempdir"
63 Wrappers for the File::Temp functions of the same name.
64
65 The default options are changed to use "temp_root" for "DIR" and
66 disable "CLEANUP", but these are overridable.
67
68 "scratch"
69 Loads Directory::Scratch and instantiates a new one, with the same
70 default options as "tempfile" and "tempdir".
71
73 • File::Temp,
74
75 • Directory::Scratch
76
77 • Path::Class
78
80 Bugs may be submitted through the RT bug tracker
81 <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-TempDir> (or
82 bug-Test-TempDir@rt.cpan.org <mailto:bug-Test-TempDir@rt.cpan.org>).
83
84 There is also a mailing list available for users of this distribution,
85 at <http://lists.perl.org/list/perl-qa.html>.
86
87 There is also an irc channel available for users of this distribution,
88 at "#perl" on "irc.perl.org" <irc://irc.perl.org/#perl-qa>.
89
91 יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
92
94 • Karen Etheridge <ether@cpan.org>
95
96 • Florian Ragwitz <rafl@debian.org>
97
99 This software is copyright (c) 2006 by יובל קוג'מן (Yuval Kogman).
100
101 This is free software; you can redistribute it and/or modify it under
102 the same terms as the Perl 5 programming language system itself.
103
104
105
106perl v5.32.1 2021-01-27 Test::TempDir(3)