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.10
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 יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
81
83 This software is copyright (c) 2006 by יובל קוג'מן (Yuval Kogman).
84
85 This is free software; you can redistribute it and/or modify it under
86 the same terms as the Perl 5 programming language system itself.
87
89 · Karen Etheridge <ether@cpan.org>
90
91 · Florian Ragwitz <rafl@debian.org>
92
93
94
95perl v5.30.0 2019-07-26 Test::TempDir(3)