Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Help with HoAoA (fetchrow_arrayref reuse)

by Anonymous Monk
on Jun 20, 2013 at 13:26 UTC ( [id://1039977]=note: print w/replies, xml ) Need Help??


in reply to Help with HoAoA

fetchrow_arrayref lists a caveat, its that it reuses the reference, so all your array refs are pointing to the same one, its common pitfall, see http://search.cpan.org/perldoc/DBI#fetchrow_arrayref

You want to use fetchrow_array and push ...\@array or store a copy with  push ... [ @$ref ]

Replies are listed 'Best First'.
Re^2: Help with HoAoA (fetchrow_arrayref reuse)
by OfficeLinebacker (Chaplain) on Jun 20, 2013 at 14:04 UTC
    Thank you. Very helpful.

    For the record, I fixed it with

    :
    while (my @row = $select_sth->fetchrow_array()) { #split on colon,space,or dash my @ticket_time = split /:|\s|-/, $row[1]; my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($ticket_time[0],$ticket_time[1],$ticket_time[2],$ti +cket_time[3],$ticket_time[4],0, $now_time[0],$now_time[1],$now_time[2],$now_time[3] +,$now_time[4],0); #my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS(@ticket_time,0,@now_time,0); my $delta_hrs = $Dd * 24 + $Dh; if ( $row[8] eq 'High' && $delta_hrs >= $thresholds{'High'}){ push @{$notify{'High'}}, \@row; }elsif ( $row[8] eq 'Medium' && $delta_hrs >= $thresholds{'Medium' +}){ push @{$notify{'Medium'}}, \@row; }elsif( $row[8] eq 'Low' && $delta_hrs >= $thresholds{'Low'}){ push @{$notify{'Low'}}, \@row; } #debug/testing statement here. warn "Time elapsed for ticket $row[0] of priority $row[8] is $delt +a_hrs."; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1039977]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found