Re: [PATCH 8/8] perl: hard-depend on the File::{Temp,Spec} modules
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 15, 2018, 21:33 UTC
- Message-ID
- <xmqqd1167xas.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <87r2pmf0hs.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 21 quoted lines
> On Wed, Feb 14 2018, Jonathan Nieder jotted:
>
>> Ævar Arnfjörð Bjarmason wrote:
>>
>>> --- a/perl/Git.pm
>>> +++ b/perl/Git.pm
>>> @@ -1324,8 +1324,9 @@ sub _temp_cache {
>>> }
>>>
>>> sub _verify_require {
>>> - eval { require File::Temp; require File::Spec; };
>>> - $@ and throw Error::Simple($@);
>>> + require File::Temp;
>>> + require File::Spec;
>>> + return;
>>
>> Same question as in the other patches: any reason not to simplify by
>> using 'use' at the top of the file instead?
>
> I was just going for the minimal change, but yeah, that makes
> sense. Will do that in v2.Yes, if we are making them hard dependency, unless a major part of the perl/Git.pm can be used without hitting _verify_require in the current code, there is no point using "require only if we use it" pattern. As _verify_require is used even in the Git::repository constructor, I think it makes more sense to have "use" upfront for these two modules.