Perl-Email-Project / Email-Valid

perl library to validate email addresses
19 stars 19 forks source link

Need local $_ when loading using Module::Runtime and readonly $_ #8

Closed gshank closed 10 years ago

gshank commented 10 years ago

The following script gets an error: Modification of a read-only value attempted at /home/gshank/CE/git/extlib/lib/perl5/x86_64-linux-gnu-thread-multi/Net/DNS/Resolver/Base.pm line 223.

!/usr/bin/env perl

use strict; use warnings; use v5.10; use Module::Runtime 'use_module'; usemodule($) for qw{ Email::Valid };

rjbs commented 10 years ago

I'm sorry to report that your princess^Wbug is in another castle^Wmodule.

perl -e 'use Net::DNS::Resolver; Net::DNS::Resolver->new for 1;'

A resolver is created as part of loading Email::Valid, and creating a resolver alters $_. The problem appears to be in the sub read_config_file in Net::DNS::Resolver::Base, when it does a while (<FILE>) -- at least that's where the error seems to originate.