On Wed, Feb 14 2018, Jonathan Nieder jotted:

> Ævar Arnfjörð Bjarmason wrote:
>
>> The Net::SMTP and Net::Domain were both first released with perl
>> v5.7.3, since my d48b284183 ("perl: bump the required Perl version to
>> 5.8 from 5.6.[21]", 2010-09-24) we've depended on 5.8, so there's no
>> reason to conditionally require this anymore.
>>
>> This conditional loading was initially added in
>> 87840620fd ("send-email: only 'require' instead of 'use' Net::SMTP",
>> 2006-06-01) for Net::SMTP and 134550fe21 ("git-send-email.perl - try
>> to give real name of the calling host to HELO/EHLO", 2010-03-14) for
>> Net::Domain, both of which predate the hard dependency on 5.8.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com>
>> ---
>>  git-send-email.perl | 24 +++++++++++-------------
>>  1 file changed, 11 insertions(+), 13 deletions(-)
>>
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index 85bb6482f2..69bd443245 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -1143,10 +1143,9 @@ sub valid_fqdn {
>>  sub maildomain_net {
>>      my $maildomain;
>>
>> -    if (eval { require Net::Domain; 1 }) {
>> -            my $domain = Net::Domain::domainname();
>> -            $maildomain = $domain if valid_fqdn($domain);
>> -    }
>> +    require Net::Domain;
>> +    my $domain = Net::Domain::domainname();
>> +    $maildomain = $domain if valid_fqdn($domain);
>
> Now that we indeed require the module, any reason not to 'use' it?
> E.g. is it particularly expensive to load?
>
> I haven't checked the assertions above about minimal perl versions
> including these modules, but I assume they're true. :)  So this looks
> like a good change.

FWIW this is easily found out for any given module by running `corelist
<module name>` on a system with perl installed:

    $ corelist File::Spec
    Data for 2017-01-14
    File::Spec was first released with perl 5.00405

Reply via email to