On Wed, Oct 22, 2008 at 09:26:45AM -0500, Todd Rinaldo wrote:
> I too would like to see inflate be a little more transparent. I
> haven't had to deal with it in a month or so, but I know that in some
> DBIC calls, you get the raw value of the column and in others, you get
> the inflated value. Vice-versa on the write. It's my humble opinion
> that if someone sets up an inflate/deflate on a column, that should be
> the interface. This has bitten us a couple of times, mostly with
> DateTime objects where we made the assumption that get_column (I
> think) would give us an inflated value, but instead gives us the raw
> value.
That's a stupid assumption. It's documented to always return the actual
-column- value. It's a bit of internals that are exposed in case you need
it, *not* part of the main interface for your objects.
The main interface for your objects is the accessors. Use them.
$obj->get_column($col); # COLUMN VALUE
$obj->$col; # ATTRIBUTE VALUE
If I could time travel, I'd make it _get_column so this fact was obvious.
But too much code now relies on it, sadly.
I suspect when we create a new, cleaner row object interface, perhaps as a
factor out in the 09 process, things like get_column will simply go away so
people don't keep making this mistake.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]