Nick Brown wrote:
I'm trying to use Finance::OFX::Response to use a ofx statement I've
it downloaded from by bank website.
http://search.cpan.org/~bfoz/p5-Finance-OFX-20080303/lib/Finance/OFX/Response.pm
However there I'm getting the following perl compilation error:
Type of arg 1 to each must be hash (not subroutine entry) at
download_statements.pl line 67, near "->ofx ) "
for the below code:
$response = $mech->get($download_url . $count);
if (!$response->is_success) {
die 'Failed to load statements URL';
}
$response = $mech->submit_form(form_name => $download_form_name, button => \
'btnDownload');
if (!$response->is_success) {
die 'Failed to get Statement Download';
}
#print $mech->content();
my $ofx_response = Finance::OFX::Response->from_http_response($response);
while( my ($k, $v) = each $ofx_response->ofx ) {
print "key: $k, value: $v.\n";
}
Can you suggest what is wrong the while loop I'm trying to use to
print the hash tree of the OFX?
values(), keys() and each() require that their first argument must be a
hash so if $ofx_response->ofx returns a reference to a hash then you
have to dereference it:
while( my ($k, $v) = each %{ $ofx_response->ofx } ) {
print "key: $k, value: $v.\n";
}
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/