Subject: | cannot get remote XML data |
I am unable to process 'remote' XML output from a website using
DBD::AnyData. However, if I pull down this same data to a file
and then use the filename instead of the website URL, I can read
in the data without any problem. Here is the program:
use DBI;
my $dbh=DBI->connect('dbi:AnyData(RaiseError=>1):');
$dbh->func( 'test', 'XML', 'http://localhost:8080/FMPro?-db=fbsccopy.fp5&-format=-dso_xml&-find',
{ 'record_tag' => 'ROW' }, 'ad_import');
$all = $dbh->selectall_arrayref(qq{
SELECT * FROM test
});
$j=0;
foreach $rowRef (@$all) {
$i=0;
foreach (@$rowRef) {
print "column $i ==> $_\n";
$i++;
}
$j++;
}
When I run the above program, I get the following errors:
Execution ERROR: Couldn't find column names! called from ./test_anydata_xml5.pl at 4.
Execution ERROR: Couldn't find column names! called from ./test_anydata_xml5.pl at 6.
DBD::AnyData::db selectall_arrayref failed:
Execution ERROR: Couldn't find column names! called from ./test_anydata_xml5.pl at 6.
DBD::AnyData::db selectall_arrayref failed:
Execution ERROR: Couldn't find column names! called from ./test_anydata_xml5.pl at 6.
If I use curl to get the web page and save it to a file, then substitute
the file name for the URL in the above program, the program works.
I do have LWP installed, and verified that it worked by getting the web
page and printing it:
use LWP::UserAgent;
my $file = 'http://localhost:8080/FMPro?-db=fbsccopy.fp5&-format=-dso_xml&-find';
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $file);
my $res = $ua->request($req);
die "[$file] : " . $res->message if !$res->is_success;
print $res->content,"\n";
I have tried this under both Mac OS X (perl 5.8.4) and Linux (perl 5.8.0).
I am using DBD-AnyData-0.08 and AnyData-0.10.