From: Abhijit Menon-Sen Date: Mon, 01 Sep 2008 10:42:22 GMT Subject: [PATCH] Git.pm: Use File::Temp->tempfile instead of ->new Message-ID: <20080901104222.GA10026@toroid.org> In-Reply-To: <48BBC20E.20808@statsbiblioteket.dk> Perl 5.8.0 ships with File::Temp 0.13, which does not have the new() interface introduced in 0.14, as pointed out by Tom G. Christensen. Signed-off-by: Abhijit Menon-Sen --- At 2008-09-01 12:21:02 +0200, tgc@statsbiblioteket.dk wrote: > > Wouldn't it be possible to accomplish the same as File::Temp->New with > the old File::Temp? OK, does this one work for you? -- ams perl/Git.pm | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/perl/Git.pm b/perl/Git.pm index 102e6a4..f383ff8 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -1021,10 +1021,13 @@ sub _temp_cache { carp "Temp file '", $name, "' was closed. Opening replacement."; } - $$temp_fd = File::Temp->new( - TEMPLATE => 'Git_XXXXXX', - DIR => File::Spec->tmpdir - ) or throw Error::Simple("couldn't open new temp file"); + eval { + ($$temp_fd) = File::Temp->tempfile( + 'Git_XXXXXX', + DIR => File::Spec->tmpdir + ); + }; + throw Error::Simple("couldn't open new temp file") if $@; $$temp_fd->autoflush; binmode $$temp_fd; } -- 1.6.0.1.161.g7f314