[Dbix-class] Converting a returned DBIx::Class result to a vanilla array/hash structure

Jess Robinson castaway at desert-island.me.uk
Sat Apr 18 10:45:38 GMT 2009


On Fri, 17 Apr 2009, John Ramsden wrote:

> A Catalyst / DBIx::Class app I am maintaining is running very
> slowly for certain pages where I have needed to copy several
> DBIx::Class resultsets into the Catalyst hash.
>
> It looks like memory is the problem, as a dump of just a single
> resultset reveals a vast heap of gobbledegook for each result,
> which may be useful for DBIx::Class itself but is none to
> Catalyst.
>
> So I wondered if there was a simple way to convert a resultset,
> with all its accessor methods and the above-mentioned rubbish,
> into a lean-and-mean vanilla read-only structure comprising just
> the returned columns.
>
> In principle I could of course do it manually. But this would be
> tedious as there are a dozen or more tables involved, and in any
> case there is no point reinventing the wheel if this is a common
> requirement already fulfilled by a standard method.
>
> Thanks in anticipation.
>

Long question, short answer:

Yes, its called DBIx::Class::HashRefInflator - go read ;)

Jess




More information about the DBIx-Class mailing list