Re: Returning multiple MySQL rows from module
- From: iaccounts@xxxxxxxxxx (Steve Bertrand)
- Date: Tue, 27 Nov 2007 14:06:53 -0500
Tom Phoenix wrote:
On 11/27/07, Steve Bertrand <iaccounts@xxxxxxxxxx> wrote:
The current setup feels very 'kludgy' to me. The code snip below comes
out of the module. I hope there is enough context to see why I think it
can be improved.
Actually, the snippet you submitted seems pretty straightforward. It
could be improved (what code couldn't?) but it's not in *need* of
improvement, IMHO: It can't become impressively faster or clearer.
What seems kludgy about it? What improvement are you seeking?
Well, I didn't like the fact I was returning an AoA. I have subsequently
changed the code to only allow a single row return, and assign it
directly to $self via a hashref instead:
-- snip --
while (my $service_info = $query->fetchrow_hashref) {
for my $field (keys %$service_info) {
$self->{$field} = $service_info->{$field};
}
}
-- end snip --
Thanks for your response Tom!
Steve
.
- Follow-Ups:
- Re: Returning multiple MySQL rows from module
- From: Rob Dixon
- Re: Returning multiple MySQL rows from module
- References:
- Returning multiple MySQL rows from module
- From: Steve Bertrand
- Re: Returning multiple MySQL rows from module
- From: Tom Phoenix
- Returning multiple MySQL rows from module
- Prev by Date: Re: Trouble with Email::MIME modules
- Next by Date: Extracting one record from multiple-records textfile
- Previous by thread: Re: Returning multiple MySQL rows from module
- Next by thread: Re: Returning multiple MySQL rows from module
- Index(es):
Relevant Pages
|