Re: [PATCH v2] Git.pm: Use File::Temp->tempfile instead of ->new
- From
Marcus Griep <marcus@griep.us>
- Date
- Sep 9, 2008, 17:35 UTC
- Message-ID
- <48C6B3F0.505@griep.us>
- In-Reply-To
- <20080909020605.GA19190@toroid.org>
Abhijit Menon-Sen wrote:
Show 7 quoted lines
> At 2008-09-08 12:53:01 -0400, marcus@griep.us wrote:
>> + my $fname;
>> + ($$temp_fd, $fname) = File::Temp->tempfile(
>> + 'Git_XXXXXX', UNLINK => 1
>> ) or throw Error::Simple("couldn't open new temp file");
>
> What happens when tempfile croaks on error?I was indifferent to the idea of catching the ->tempfile croak just to hide it in our own error (since the ->tempfile croak would have more information), in which case the extra 'or throw' may be superfluous, but I kept it as a defensive programming practice.
-- Marcus Griep GPG Key ID: 0x5E968152 —— http://www.boohaunt.net את.ψο´