.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Arch::TempFiles 3pm" .TH Arch::TempFiles 3pm "2022-06-08" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Arch::TempFiles \- help to manage temporary files/dirs .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& use Arch::TempFiles qw(temp_file_name temp_file temp_dir); \& # all will be removed automatically on the script completion \& my $file_name1 = temp_file(); \& my $file_name2 = temp_file_name("status"); \& my $dir_name = temp_dir("arch\-tree"); \& \& use Arch::TempFiles; \& my $tmp = new Arch::TempFiles; \& $tmp\->root($tmp\->dir); \& my $file_name = $tmp\->name; \& open OUT, ">$file_name"; \& close OUT; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module deals with temporary file names. It is similar to File::Temp, but simplier and more focused. Also, File::Temp is relatively new and was not shipped with older perl versions. .PP Both function interface and object oriented interface are supported. .SH "FUNCTIONS/METHODS" .IX Header "FUNCTIONS/METHODS" The following functions are available: .PP \&\fBtemp_root\fR, \&\fBtemp_name\fR, \&\fBtemp_file_name\fR, \&\fBtemp_dir_name\fR, \&\fBtemp_file\fR, \&\fBtemp_dir\fR. .PP The corresponding class methods are available too: .PP \&\fBroot\fR, \&\fBname\fR, \&\fBfile_name\fR, \&\fBdir_name\fR, \&\fBfile\fR, \&\fBdir\fR. .IP "\fBtemp_root\fR [\fIdir\fR]" 4 .IX Item "temp_root [dir]" .PD 0 .ie n .IP "$tmp\->\fBroot\fR [\fIdir\fR]" 4 .el .IP "\f(CW$tmp\fR\->\fBroot\fR [\fIdir\fR]" 4 .IX Item "$tmp->root [dir]" .PD Change or return the root of the temporary files and dirs. The default is either \f(CW$ENV\fR{\s-1TMP_DIR\s0} or \*(L"/tmp\*(R". .IP "\fBtemp_name\fR [\fIlabel\fR]" 4 .IX Item "temp_name [label]" .PD 0 .ie n .IP "$tmp\->\fBname\fR [\fIlabel\fR]" 4 .el .IP "\f(CW$tmp\fR\->\fBname\fR [\fIlabel\fR]" 4 .IX Item "$tmp->name [label]" .PD Return the unused temporary file name. The default file name is \&\*(L"/tmp/,,arch\-XXXXXX\*(R" where \s-1XXXXXX\s0 is a random number. To change this name use \f(CW\*(C`temp_root\*(C'\fR and/or provide \fIlabel\fR that replaces \*(L"arch\*(R". .Sp Please note, that the operation of acquiring the file name using this function/method and actual creating of this file is not atomic. So you may need to call this method again if the creation is failed, for example if some other process created the same file in the middle. .IP "\fBtemp_file_name\fR [\fIlabel\fR]" 4 .IX Item "temp_file_name [label]" .PD 0 .ie n .IP "$tmp\->\fBfile_name\fR [\fIlabel\fR]" 4 .el .IP "\f(CW$tmp\fR\->\fBfile_name\fR [\fIlabel\fR]" 4 .IX Item "$tmp->file_name [label]" .PD Like \f(CW\*(C`temp_name\*(C'\fR, but stores the name in the file list that will be removed on the end (on object destruction). .IP "\fBtemp_dir_name\fR [\fIlabel\fR]" 4 .IX Item "temp_dir_name [label]" .PD 0 .ie n .IP "$tmp\->\fBdir_name\fR [\fIlabel\fR]" 4 .el .IP "\f(CW$tmp\fR\->\fBdir_name\fR [\fIlabel\fR]" 4 .IX Item "$tmp->dir_name [label]" .PD Like \f(CW\*(C`temp_name\*(C'\fR, but stores the name in the dir list that will be removed on the end (on object destruction). .IP "\fBtemp_file\fR [\fIlabel\fR]" 4 .IX Item "temp_file [label]" .PD 0 .ie n .IP "$tmp\->\fBfile\fR [\fIlabel\fR]" 4 .el .IP "\f(CW$tmp\fR\->\fBfile\fR [\fIlabel\fR]" 4 .IX Item "$tmp->file [label]" .PD Like \f(CW\*(C`temp_file_name\*(C'\fR, but also creates the file. .IP "\fBtemp_dir\fR [\fIlabel\fR]" 4 .IX Item "temp_dir [label]" .PD 0 .ie n .IP "$tmp\->\fBdir\fR [\fIlabel\fR]" 4 .el .IP "\f(CW$tmp\fR\->\fBdir\fR [\fIlabel\fR]" 4 .IX Item "$tmp->dir [label]" .PD Like \f(CW\*(C`temp_dir_name\*(C'\fR, but also creates the dir. .SH "BUGS" .IX Header "BUGS" Awaiting for your reports. .SH "AUTHORS" .IX Header "AUTHORS" Mikhael Goikhman (migo@homemail.com\*(--Perl\-GPL/arch\-perl\*(--devel). .SH "SEE ALSO" .IX Header "SEE ALSO" For a different interface, see File::Temp.