Sorry, my example wasn't very helpful in that respect. Yes, you are right about it controlling the cache capacity. However, even when I set it to large values (100, 1000, 100000 etc) it makes no difference.
After some digging around in the code for LWP::UserAgent (5.835) I found this
sub clone
{
my $self = shift;
my $copy = bless { %$self }, ref $self; # copy most fields
delete $copy->{handlers};
delete $copy->{conn_cache};
# copy any plain arrays and hashes; known not to need recursive co
+py
for my $k (qw(proxy no_proxy requests_redirectable)) {
next unless $copy->{$k};
if (ref($copy->{$k}) eq "ARRAY") {
$copy->{$k} = [ @{$copy->{$k}} ];
}
elsif (ref($copy->{$k}) eq "HASH") {
$copy->{$k} = { %{$copy->{$k}} };
}
}
if ($self->{def_headers}) {
$copy->{def_headers} = $self->{def_headers}->clone;
}
# re-enable standard handlers
$copy->parse_head($self->parse_head);
# no easy way to clone the cookie jar; so let's just remove it for
+ now
$copy->cookie_jar(undef);
$copy;
}
So it looks like the conn_cache data is not inherited when the UserAgent is cloned.
If I comment this line out (delete $copy->{conn_cache};), my problems go away. Could a more enlightened member tell me whether or not this looks like a bug, or am I just barking mad and fiddling with something with terrible unintended consequences?
Cheers LB
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|