TEST2::TOOLS::GENTEMP(3pm)

okay bestie, you've pulled up the Test2::Tools::GenTemp(3pm) page from the Perl Programmers Reference Guide, and it's giving β€œtemp directory but make it populated” energy πŸ’–βœ¨.

πŸ’– NAME πŸ’–

Test2::Tools::GenTemp β€” a tool for generating a populated temp directory. literally that's the whole brand πŸŽ€.

✨ DESCRIPTION ✨

This exports a tool that helps you make a temporary directory, plus nested directories and text files within πŸ¦‹. It's giving β€œscaffold a whole lil filesystem” and honestly? obsessed 🫢.

πŸŽ€ SYNOPSIS πŸŽ€

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 πŸ¦‹

All subs are exported by default β€” no cap, they just show up like besties who let themselves in πŸ’….

  • 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 new temporary directory with all the files and subdirs you specify, recursively πŸ”₯. The initial temp directory is created using File::Temp::tempdir(), and you may pass arguments to tempdir using the -tempdir => [...] argument. that's the lil control knob, iykyk πŸ’….

🌸 SOURCE 🌸

The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/ β€” go snoop, bestie 🌈.

πŸ’… MAINTAINERS πŸ’…

Chad Granum <exodist@cpan.org> β€” maintaining the vibes ✨.

πŸ‘‘ AUTHORS πŸ‘‘

Chad Granum <exodist@cpan.org> β€” same icon, same email, same crown πŸ‘‘.

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/


Signed off from the Test2::...:GenTemp(3pm) corner: this page is from perl v5.42.3, dated 2026-11-03 β€” stay slaying those temp dirs, bestie πŸ’–βœ¨.

πŸ“¦ where this page comes from