neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
There are many sections similar to the one above. Sometimes, the error below is returned instead of the expected results.$url = "https://www.example.com/reports/newIssues/changeParams2.jsp"; $error {newoff_entry} {url} = $url; $req = HTTP::Request->new(POST => $url); $req->content_type('application/x-www-form-urlencoded'); $cjar->add_cookie_header($req); $req->header(userid => $user); $req->content("userid=$user&SessionId=$sessid&language=en"); $ua->{'timeout'} = $timeout; $t0 = new Benchmark; $resp = $ua->send_request($req); $t1 = new Benchmark; $error {newoff_entry} {rt} = timediff($t1, $t0); $cjar->extract_cookies($resp); #$debug = $resp->as_string(); if (($resp->as_string() =~ /RR\s+codes/i)||($resp->as_string() =~ /$ss +l_bug/)){ $error {newoff_entry} {rc} = 'ok'; }else{ $error {newoff_entry} {rc} = 'error'; }
I suspect that there may be an error acquiring the web content. Perhaps I need some error checking but, I don't have enough experience with the UserAgent to understand where to begin.bad time value () at /usr/lib/perl5/5.8.0/Benchmark.pm line 510. Can't call method "cpu_p" on an undefined value at /usr/lib/perl5/5.8. +0/Benchmark.pm line 512.
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Benchmarking LWP::UserAgent requests
by leocharre (Priest) on Apr 12, 2006 at 15:04 UTC |