in reply to Dumper dereferencing problem
First of all I think your code has a bug in the while loop on one hand you are retrieving one record and storing it in the $trade variable, on the other hand when calling $action() you are retrieving another record so you are not processing half of the records with the $action and if your query returns only one record it won't get processed but it.
Secondly if you what to dump records I'd recommend you to use Data::Dumper, in the following form
UNTESTED
sub processTrades { my ($self,$action) = @_; my $count = 0; my $trdstmt = $self->_getTradesStatement(); $trdstmt->bind_param(1,$self->{'startdate'}); $trdstmt->bind_param(2,$self->{'enddate'}); $trdstmt->execute(); while(my $trade = $trdstmt->fetchrow_hashref()) { # Debug # use Data::Dumper; print STDERR Dumper($trade); # /Debug # &$action($trade); #Corrected# $count++; } return $count; }
|
|---|