1File::Tempdir(3) User Contributed Perl Documentation File::Tempdir(3)
2
3
4
6 File::Tempdir
7
9 use File::Tempdir;
10
11 {
12 my $tmpdir = File::Tempdir->new()
13 my $dir = $tmpdir->name;
14 }
15 # the directory has been trashed
16 my $adir = 'any directory';
17 {
18 my $tmpdir = File::Tempdir->new($dir)
19 my $dir = $tmpdir->name;
20 }
21 # the directory has not been trashed
22
24 This module provide an object interface to tempdir() from File::Temp.
25 This allow to destroy the temporary directory as soon you don't need it
26 anymore using the magic DESTROY() function automatically call be perl
27 when the object is no longer reference.
28
29 If a value is passed to at object creation, it become only a container
30 allowing to keep same code in your function.
31
33 new(@options)
34 if @options is only one defined value, the directory is simply retain
35 in memory and will not been trashed.
36
37 Otherwise, @options are same than tempdir() from File::Temp. Refer to
38 File::Temp documentation to have options list. In this case, the
39 directory will be trashed.
40
41 name
42 Return the name of the directory handle by the object.
43
45 In "tempdir" in File::Temp File::Path Directory::Scratch
46
48 Olivier Thauvin <nanardon@nanardon.zarb.org>
49
51 http://nanardon.zarb.org/darcsweb/darcsweb.cgi?r=Tempdir
52
53 darcs get http://nanardon.zarb.org/darcs/Tempdir
54
56 This program is free software; you can redistribute it and/or modify it
57 under the same terms as Perl itself.
58
59
60
61perl v5.38.0 2023-07-20 File::Tempdir(3)