Subject: | weird URI/URI::Escape behavior with Readonly |
This is weird. If I change this to assign the vars of the 'for' loop to
a loop var instead of $_, it works as expected. However, I'm not
passing $_ to the UserAgent at all, the call to get() uses a new string.
Why would something in URI try to operate on and modify $_ at the scope
of the caller's loop? This is perl 5.8.8 in CentOS. Thanks have a nice
day. --mark--
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use English '-no_match_vars';
use YAML;
use Readonly;
use LWP;
Readonly my @lame => qw(
www.google.com
www.yahoo.com
);
my $ua = LWP::UserAgent->new();
for (@lame) {
my $response = $ua->get("http://$_");
print Dump($response->headers);
}
__END__
hedges@foo:~$ ~/lame.pl
Modification of a read-only value attempted at
/usr/lib/perl5/site_perl/5.8.8/URI/_server.pm line 6
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.8/URI/http.pm line 3.
Compilation failed in require at (eval 15) line 3.
Callback called exit.
END failed--call queue aborted at /home/digicine/hedges/lame.pl line 6.
In a more complex script it turned up as:
Modification of a read-only value attempted at
/usr/lib/perl5/site_perl/5.8.8/HTTP/Config.pm line 4
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.8/LWP/UserAgent.pm line 746.
Callback called exit.