Not certain if this is the right list for this question, if not, please tell
me where to go. ;-)
I'm writing a simple (simplistic?) character-mode web scripting tool using
LWP.
As I "record" a session, I store HTTP::Request objects in @requests.
At the end:
my $requests_xml = dump_xml(@requests);
print SCRIPT $requests_xml;
close SCRIPT;
So far, so good.
Then I go to "replay" a script saved in this manner:
my $p = Data::DumpXML::Parser->new;
my $requests_ref = $p->parsefile($FILE);
@requests = @$requests_ref;
foreach my $req (@requests) {
$sub_request = 1;
execute_request($req);
}
sub execute_request {
my($req) = @_;
#$req->header('Accept-encoding' => 'gzip, deflate');
print "\nReq #$req_nbr.$sub_request:\n",$req->as_string;
my $res = $ua->request($req);
#etc.
}
Things still look good ref($req) returns "HTTP::Request".
But, any method calls, such as $req->as_string, or the $ua->request($req)
above fail, like this:
Can't locate object method "as_string" via package "URI::http" (perhaps you
forgot to load "URI::http"?) at
/usr/lib/perl5/site_perl/5.6.1/HTTP/Request.pm line 144.
Am I doing something dumb here, or is this a limitation of Data::DumpXML?
Thanks for any assistance you can provide.
Regards,
David
-----
David Carter
Sr. Principal Consultant, Professional Services
S1 Corporation
3500 Lenox Road, Suite 200
Atlanta, GA 30326 U.S.A.
T: + 1 404.923.7366 C: +1 770.329.1742
E: [EMAIL PROTECTED] Visit us at <http://www.s1.com/>
"Turning Customer Interactions into Profits"