|
ru.perl- RU.PERL ---------------------------------------------------------------------- From : Andrew Alakozow 2:5061/6 12 Apr 2003 19:37:52 To : Roman Kirjanov Subject : Re: tempnam('/tmp', 'foo') -------------------------------------------------------------------------------- RK> Hужна функция, которая бы придумывала уникальное имя файла в заданном RK> каталоге. Думаю, что есть стандартная - в ПХП есть. Пример из Perl Cookbook: use IO::File; use POSIX qw(tmpnam); # try new temporary filenames until we get one that didn't already exist do { $name = tmpnam() } until $fh = IO::File->new($name, O_RDWR|O_CREAT|O_EXCL); # install atexit-style handler so that when we exit or die, # we automatically delete this temporary file END { unlink($name) or die "Couldn't unlink $name : $!" } # now go on to use the file ... aa29 --- Microsoft Outlook Express 6.00.2720.3000 * Origin: Life In The Dark (2:5061/6) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.perl/437150d3e0c2c.html, оценка из 5, голосов 10
|