From: Jay Soffian Date: Fri, 14 Mar 2008 21:11:53 GMT Subject: Re: [PATCH] gitweb: Support caching projects list Message-ID: <76718490803141411v24c31de5x8ba25fcd1654b4e7@mail.gmail.com> In-Reply-To: On Fri, Mar 14, 2008 at 11:29 AM, Jakub Narebski wrote: > What should the code for this look like? Like below? > > use File::Temp; > > my ($fh, $temp_file) = tempfile(); > ... > close $fh; > rename $temp_file, $cache_file; I always use something like: my $temp_file = "$cache_file.tmp$$"; open(my $fh, ">$temp_file"); to ensure that the temp file is on the same filesystem. j.