1Test2::Tools::GenTemp(3U)ser Contributed Perl DocumentatiToenst2::Tools::GenTemp(3)
2
3
4
6 Test2::Tools::GenTemp - Tool for generating a populated temp directory.
7
9 This exports a tool that helps you make a temporary directory, nested
10 directories and text files within.
11
13 use Test2::Tools::GenTemp qw/gen_temp/;
14
15 my $dir = gen_temp(
16 a_file => "Contents of a_file",
17 a_dir => {
18 'a_file' => 'Contents of a_dir/afile',
19 a_nested_dir => { ... },
20 },
21 ...
22 );
23
24 done_testing;
25
27 All subs are exported by default.
28
29 gen_temp(file => 'content', subdir => [ sub_dir_file => 'content',
30 ...], ...)
31 gen_temp(-tempdir => \@TEMPDIR_ARGS, file => 'content', subdir => [
32 sub_dir_file => 'content', ...], ...)
33 This will generate a new temporary directory with all the files and
34 subdirs you specify, recursively. The initial temp directory is
35 created using "File::Temp::tempdir()", you may pass arguments to
36 tempdir using the "-tempdir => [...]" argument.
37
39 The source code repository for Test2-Suite can be found at
40 https://github.com/Test-More/Test2-Suite/.
41
43 Chad Granum <exodist@cpan.org>
44
46 Chad Granum <exodist@cpan.org>
47
49 Copyright 2018 Chad Granum <exodist@cpan.org>.
50
51 This program is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself.
53
54 See http://dev.perl.org/licenses/
55
56
57
58perl v5.32.0 2020-12-16 Test2::Tools::GenTemp(3)