In < .com>,
mentions:
>On Mar 22, 9:18 pm, nos...@geniegate.com (Jamie) wrote:
>> --http://www.geniegate.com Custom web programming
>> Perl * Java * UNIX User Management Solutions
>
>Hi,
>It's hanging on get. I'm using get on a url which is secured (https),
>and it works for quite a long time untill suddenly it stops and
>hangs.
>When you say you override the method - how exactly is it done? how can
>i verify what parameters it is trying to use?
>
>thanks for you help!
Do this: perldoc -m LWP::UserAgent
It'll give you the source code for LWP::UserAgent.
Then, in a sub or another package or a variety of ways..
NOTE:!!!!! Not-tested code, this is just a "for example" thing!
I'll probably goof this up, I'm editing "live" so beware...
sub get_ua {
{
package My::Ua;
use LWP::UserAgent;
use base 'LWP::UserAgent';
use strict;
# Use our bugged version to snoop in on things.
sub get {
my($self,@args) = @_;
print "CP1: $self called with " . join(',',@args), "\n";
my $rv = $self->SUPER::get(@args);
print "CP2: returning from get\n";
return($rv);
}
}
return(My::Ua->new(@_)); # Create our own version of LWP::UserAgent.
}
When you construct your LWP::UserAgent object, call get_ua() instead, in
the customized get() method above, you can insert print statements and
so on which will tell you the precise URL it's attempting to fetch. (you
can make a note of the URL's and observe if it's always the same URL,
this would be a key piece of information)
Confirm things are as they should, then follow along the path of LWP
until you get to request() (and at that point.. it's probably just
as easy to copy the whole thing over and pollute with print statements)
placing "CPnnn" statements in along the way.
At the end of it all, you'll get to a point where there isn't a "CPnnn"
printed where you think there ought to be one. At that point, you'll
have found exactly where it's hanging, and, if you're lucky.. it'll
be something obvious.

If not, at least you'll have a good idea what's
wrong.
Do NOT modify the source of LWP::UserAgent (or any other module for that
matter) directly, always copy, or if it's more convenient, do a
custom override as above. Otherwise you'll end up with corrupt modules.
See Also: LWP:

ebug
Though I've never used it, every problem I've ever had was as a result of me
passing the wrong stuff into get/post, I've never had to go further than what
I've described above. (and I usually override LWP::UserAgent in the beginning
anyway, just in case I might want to change it's behavior later on in
program development, ex: password fetching)
The above is just a debugging method I've found useful for "tough cases".
Jamie
--
http://www.geniegate.com Custom web programming
Perl * Java * UNIX User Management Solutions