TEST2::TOOLS::GENTEMP(3perl)
π Test2::Tools::GenTemp π
okay so bestie, this is the Test2::Tools::GenTemp page from the Perl Programmers Reference Guide (section 3perl), and it's literally the cutest little helper for making temp dirs that are already full of stuff. no cap.
β¨ NAME β¨
Test2::Tools::GenTemp β a tool for generating a populated temp directory. that's it, that's the whole vibe. π
πΈ DESCRIPTION πΈ
this thing exports a tool that helps you make a temporary directory, and then also nested directories and text files inside it. like, you say what you want the tree to look like, and it just appears. main character energy fr fr. π¦
π SYNOPSIS π
here's the whole thing in action, bestie:
use Test2::Tools::GenTemp qw/gen_temp/;
my $dir = gen_temp(
a_file => "Contents of a_file",
a_dir => {
'a_file' => 'Contents of a_dir/afile',
a_nested_dir => { ... },
},
...
);
done_testing;
look at that. obsessed. ππ
π EXPORTS π
all subs are exported by default β every single one, no gatekeeping here. π
gen_temp(file => 'content', subdir => [ sub_dir_file => 'content', ...], ...)gen_temp(-tempdir => \@TEMPDIR_ARGS, file => 'content', subdir => [ sub_dir_file => 'content', ...], ...)
so what this does: it generates a brand new temporary directory with all the files and subdirs you specify, recursively, down and down and down. π the initial temp directory gets created using File::Temp::tempdir(), and if you wanna pass arguments to tempdir you can do that with the -tempdir => [...] argument. iykyk. β¨
π₯ SOURCE π₯
the source code repository for Test2-Suite lives at https://github.com/Test-More/test-more/. go look, it's giving open source royalty. π
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π AUTHORS π
Chad Granum <exodist@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt. β¨
See http://dev.perl.org/licenses/
and that's the whole page bestie!! thanks for reading, mwah π
this was perl v5.44.0, dated 2026-10-17, from Test2::Tools::GenTemp(3perl) β slay, bye!! ππ¦π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms