Skip Menu |

This queue is for tickets about the DBIx-Simple CPAN distribution.

Report information
The Basics
Id: 44673
Status: rejected
Priority: 0/
Queue: DBIx-Simple

People
Owner: Nobody in particular
Requestors: metaperl [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.32
Fixed in: (no value)



Subject: calling ->hash() on a DBIx::Simple::Result object fails if called more than once
It would be nice if there were an option to cache the results of calling $dsr->hash()... this way, multiple calls to ->hash() would work instead of failing on all times after the first call.
On Mon Mar 30 11:06:01 2009, TBONE wrote: Show quoted text
> It would be nice if there were an option to cache the results of calling > $dsr->hash()... > > this way, multiple calls to ->hash() would work instead of failing on > all times after the first call.
I disagree this behavior should be changed. The documentation say that this method: "Fetches a single row and returns a hash reference". "Fetch" is used consistently throughout the documentation to mean something like: "shift" or "pop". It always gets the next row. This is done consistently throughout this module, and models the same documentation and behavior in the underlying DBI. If any change should be made, perhaps a note should be added to clarify what "fetch" means, or the documentation should more clearly refer to a *next* row: "Fetches the next row and returns a hash reference"
RT-Send-CC: juerd [...] juerd.nl
Juerd, Could you comment on this bug report and possibly mark it as resolved? I'm willing to volunteer as a CO-MAINT for the module if that would be helpful. We use it in production a busy national website now and have a vested interest in it. Mark
Exactly like Mark indicated, hash is supposed to retrieve a single row each time it is called. If you need to re-use the value, put it in a variable :) -- Juerd