Over the last week on irc, someone asked the question about how to deal
with currency columns and formatting in DBIC. I pointed them to
Handel::Currency and Handel::Storage::DBIC from the upcoming 1.0.

In short, what Handel does is that it accepts a list of 'currency
columns', and sets the inflate/deflate subs to use Handel::Currency.
Handel::Currency is just a simple object that holds the real number
value, and provides convert(), format() methods that use the various
currency formatting/conversion bits from CPAN....but I digress.

The comment was made by me that those are such generic, but helpful
things, that I'd like to split this out from Handel at some point;
creating both a generic currency class that provides the format/convert
API, and a DBIC class that provides the currency column inflate/deflate
mappings...kind of like what DigestColumns does.

Now, my first question is, what are DBICs goals for the InflateColumn::
namespace? Is it going to move to having different classes for different
types in there? Or are pure component classes better, like DigestColumns?

If there was an InflateColumn::Currency, what would it do?

Some people want to use ints, some real numbers, some decimal, and some
dbs use 'money' columns, etc. Rather than guessing from the data_type
like InflateColumn::DateTime does, what about something more generic in
there?

add_columns(
  price => {
    data_type   => 'decimal',
    is_currency => 1
  }
)

Then, when is_currency is set, InflateColumn::Currency sets the
inflate/deflates appropriately.

Thoughts?
-=Chris

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to