[CDBI] custom has_a accessors
Michael Reece <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
has anyone hacked CDBI::Relationship::HasA or otherwise solved the challenge of custom accessor names for has_a relationships? i am trying to solve the general case of my foreign key columns being named foo_id, and wanting to access $thing->foo instead of $thing- >foo_id to get the object. i've currently done it with some hacks involving AUTOLOAD so that $thing->foo maps to $thing->foo_id and $thing->foo_id maps to $thing- >foo->id, but am looking for something more graceful.