[Bast-commits] r3852 - DBIx-Class/0.08/trunk/lib/DBIx/Class
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Sat Nov 3 02:17:12 GMT 2007
Author: castaway
Date: 2007-11-03 02:17:11 +0000 (Sat, 03 Nov 2007)
New Revision: 3852
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/InflateColumn.pm
Log:
Improve inflatecolumn docs
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/InflateColumn.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/InflateColumn.pm 2007-11-03 00:23:56 UTC (rev 3851)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/InflateColumn.pm 2007-11-03 02:17:11 UTC (rev 3852)
@@ -25,13 +25,20 @@
for the database.
It can be used, for example, to automatically convert to and from
-L<DateTime> objects for your date and time fields.
+L<DateTime> objects for your date and time fields. There's a
+conveniece component to actually do that though, try
+L<DBIx::Class::InflateColumn::DateTime>.
-It will accept arrayrefs, hashrefs and blessed references (objects),
-but not scalarrefs. Scalar references are passed through to the
-database to deal with, to allow such settings as C< \'year + 1'> and
-C< \'DEFAULT' > to work.
+It will handle all types of references except scalar references. It
+will not handle scalar values, these are ignored and thus passed
+through to L<SQL::Abstract>. This is to allow setting raw values to
+"just work". Scalar references are passed through to the database to
+deal with, to allow such settings as C< \'year + 1'> and C< \'DEFAULT' >
+to work.
+If you want to filter plain scalar values and replace them with
+something else, contribute a filtering component.
+
=head1 METHODS
=head2 inflate_column
@@ -57,8 +64,7 @@
The coderefs you set for inflate and deflate are called with two parameters,
the first is the value of the column to be inflated/deflated, the second is the
-row object itself. Thus you can call C<< ->result_source->schema->storage->dbh >> on
-it, to feed to L<DateTime::Format::DBI>.
+row object itself. Thus you can call C<< ->result_source->schema->storage->dbh >> in your inflate/defalte subs, to feed to L<DateTime::Format::DBI>.
In this example, calls to an event's C<insert_time> accessor return a
L<DateTime> object. This L<DateTime> object is later "deflated" when
More information about the Bast-commits
mailing list