in reply to Single row selects with Class::DBI

Howdy!

May I recommend the 'construct' method?

Turn

sub my_beta_from_alpha { my ($class, %args) = @_; my $sth = $class->sql_by_alpha(@args{qw(bloop glank)}); $sth->execute; my $result = $sth->fetchrow_arrayref; return @$result; }
into
sub my_beta_from_alpha { my ($class, %args) = @_; my $sth = $class->sql_by_alpha(@args{qw(bloop glank)}); $sth->execute; my $result = $class->construct($sth->fetchrow_hashref); return $result; }

yours,
Michael

Replies are listed 'Best First'.
Re^2: Single row selects with Class::DBI
by VSarkiss (Monsignor) on Jan 25, 2005 at 19:09 UTC