After a couple days of tinkering I'm happy to announce that InflateColumn::Currency has taken a usable form, bringing with it the automatic inflation/deflation of currency-based columns into Data::Currency objects.
You can get the latest version from here: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class-InflateColumn-Currency/ I'm going to spend a little more time with tests/coverage when I get back in a few days before I release a version to CPAN. From the README: > package Item; > __PACKAGE__->load_components(qw/InflateColumn::Currency/); > __PACKAGE__->add_columns( > price => { > data_type => 'decimal', > size => [9,2], > is_nullable => 0, > default_value => '0.00', > is_currency => 1 > } > ); > print 'US Dollars: ', $item->price; > print 'Japanese Yen: ', $item->price->convert('JPY'); Just about any part of the inflation can be tweaked at the ResultSource or column level: Change the behaviour for all columns: __PACKAGE__->currency_code('USD'); __PACKAGE__->currency_format('FMT_STANDARD'); __PACKAGE__->currency_class('MyCurrencyClass'); For each column: __PACKAGE__->add_columns( price => { data_type => 'decimal', size => [9,2], is_nullable => 0, default_value => '0.00', is_currency => 1, currency_code => 'USD', currency_code_column => 'some_other_column_with_code', currency_class => 'SomeOtherClass' } Hopefully everything is somewhat sane and not too much will change before release. Happy coding. -=Chris
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]/
