[Dbix-class] Pseudo columns
Paul Makepeace
paulm at paulm.com
Thu Oct 26 04:31:06 BST 2006
I have a legacy database that encodes three booleans into an integer,
0-7. I've like to present three accessors alongside the other columns
that map to that integer. If I can automagically update it all the
better.
So I have,
$chart->story_text_used() # 0-7, real database column
and would prefer
$chart->show_headline() # 0,1; not in the db
$chart->show_synopsis() # ditto
$chart->show_comment() # ditto
One thought was: I see there's an example of overriding store_column
in the cookbook, presumably I'd need to override override get_column
as well?
Or is there another way?
In particular, I'd like to be able to say "these are non-DB-backed
columns" and instantiate them on the fly rather than necessarily
putting them in the schema class. So e.g. in a Cat controller I could
make a couple of columns on the fly that the template could use just
as another column. Is this possible? I know it sounds kind of horrible
but it would at the very least help debugging.
Thanks,
Paul
More information about the DBIx-Class
mailing list