Test2::...:GenTemp(3)
π Test2::Tools::GenTemp β the manual, but make it make sense
Ok so real talk, bestie: this is the page for Test2::Tools::GenTemp (from the Perl world, user-contributed docs, iykyk). Let me break it down for you π
β¨ NAME β¨
Test2::Tools::GenTemp β literally a tool for generating a populated temp directory. That's it, that's the whole vibe π
πΈ DESCRIPTION πΈ
This one exports a tool that helps you make a temporary directory, and then it'll also nest directories and text files inside it for you. No cap, it does the whole scaffolding thing so you don't have to π«Ά
π¦ SYNOPSIS π¦
Here's the main character energy in action:
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;
π EXPORTS π
Every single sub here is exported by default β no asking, it just shows up π
π§ gen_temp(file => 'content', subdir => [ sub_dir_file => 'content', ...], ...)
π§ gen_temp(-tempdir => \@TEMPDIR_ARGS, file => 'content', subdir => [ sub_dir_file => 'content', ...], ...)
This will generate a brand new temporary directory, loaded with all the files and subdirs you specify, recursively. Obsessed with the recursion tbh β¨
The initial temp directory is created using File::Temp::tempdir(), and if you want to pass arguments to tempdir, you do it with the -tempdir => [...] argument. That's the lil hookup right there π
π₯ SOURCE π₯
The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. Go look, it's giving open source excellence π«Ά
β 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.
See http://dev.perl.org/licenses/
Ok that's a wrap bestie π Ngl it's a cute little module. Version check for the record:perl v5.42.0, dated2025-07-28β that's theTest2::...:GenTemp(3)page, signed off, sealed, delivered πβ¨π¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-Test-Simple 1.302214-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms