[Dbix-class] Class methods on result source classes
evaldas at imbrasas.com
Mon Sep 3 16:13:49 GMT 2007
If you all you need is to be able to write class methods for your
model classes, you can use DBIx::Class::ResultSetManager:
On 9/3/07, Pedro Melo <melo at simplicidade.org> wrote:
> I'm using a "fat model" approach in a small project and one thing
> that keeps popping up is class methods.
> For example, I usually have a can_edit() method in a base class that
> all my sources use. This allows me to do something like this:
> The can_edit() method will receive as "self" the Book with the $id,
> and it will just work.
> But if I want to write a can_create(), I do something like:
> or like this
> The second one is longer but easier to do because it doesn't require
> me to create a ResultSet class for each source.
> Any common, more elegant, solution to this problems?
> Pedro Melo
> Blog: http://www.simplicidade.org/notes/
> XMPP ID: melo at simplicidade.org
> Use XMPP!
> List: http://lists.rawmode.org/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://email@example.com
More information about the DBIx-Class