6. DBIx::Class Benefits
● No more writing SQL
– (You still can, if needed.)
● Ease of use
– Put junior developers to work faster
7. DBIx::Class Caveats
● No SQL
– Figuring out how to express complex queries can be
irksome
● Startup overhead
– DBIx::Class leverages lots of other CPAN modules
● Result class code
– Rewriting CREATE TABLEs in DBIx::Class result class
code may seem redundant
17. Dynamic DBIC
● In Schema class:
package MyBlog::Schema;
use base qw/DBIx::Class::Schema::Loader/;
18. Components/Inflating
● DBIx::Class makes it easy to coerce a table field into an
object.
– __PACKAGE__>load_components("InflateColumn::DateTime");
● Then, specify the column type as datetime
– __PACKAGE__>add_columns(
...
post_timestamp => { type => 'datetime' },
...
);
● For more info, see DBIx::Class::InflateColumn::DateTime
19. Other inflators
● DBIx::Class::InflateColumn::IP
– Coerces field into NetAddr::IP
● DBIx::Class::InflateColumn::URI
– Coerces field into URI
● DBIx::Class::InflateColumn::Currency
– Coerces field into Data::Currency
● And you can roll your own!
20. Learning more
● Excellent POD
– DBIx::Class::Manual::DocMap
– DBIx::Class::Manual::Intro
– DBIx::Class::Manual::Cookbook
● http://www.dbix-class.org/
● Mailing list
– http://lists.scsys.co.uk/mailman/listinfo/dbix-class
● IRC
– irc.perl.org#dbix-class