File::Tempdir(3)
π¦ NAME π¦
okay so bestie, this is File::Tempdir β the File::Tempdir(3) page from the User Contributed Perl Documentation. It gives you an object interface to tempdir() from File::Temp. The whole vibe? You can destroy the temporary directory as soon as you don't need it anymore, using the magic DESTROY() function that perl automatically calls when the object is no longer referenced. No cap, that's the main character move.
If you pass a value when the object is created, it becomes just a container, so you can keep the same code inside your function. iykyk.
β¨ SYNOPSYS β¨
Here's the group-chat screenshot of how it looks:
use File::Tempdir;
{
my $tmpdir = File::Tempdir->new()
my $dir = $tmpdir->name;
}
# the directory has been trashed
my $adir = 'any directory';
{
my $tmpdir = File::Tempdir->new($dir)
my $dir = $tmpdir->name;
}
# the directory has not been trashed
π DESCRIPTION π
This module provides an object interface to tempdir() from File::Temp. It lets you destroy the temporary directory as soon as you don't need it anymore, using the magic DESTROY() function automatically called by perl when the object is no longer referenced.
If a value is passed at object creation, it becomes only a container that allows you to keep the same code in your function. Basically: same function shape, different energy.
π FUNCTIONS π
new(@options)
If @options is only one defined value, the directory is simply retained in memory and will not be trashed. It just hangs out.
Otherwise, @options are the same as tempdir() from File::Temp. Refer to the File::Temp documentation to get the options list. In this case, the directory will be trashed. Yes, really β it gets yeeted when the object is done.
name
Returns the name of the directory handled by the object. Iconic little accessor.
π SEE ALSO π
"tempdir"inFile::TempFile::PathDirectory::Scratch
π AUTHOR π
Olivier Thauvin <nanardon@nanardon.zarb.org> β author icon, periodt.
π¦ URL π¦
http://nanardon.zarb.org/darcsweb/darcsweb.cgi?r=Tempdirdarcs get http://nanardon.zarb.org/darcs/Tempdir
π LICENSE AND COPYRIGHT π
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Slay, legal bestie.
π cute sign-off: this File::Tempdir(3) page is from perl v5.32.1, dated 2022-01-21. periodt. π
π¦ where this page comes from
- epel 9: perl-File-Tempdir 0.02-19.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms