On Sun, Jul 29, 2007 at 09:36:09AM +0100, Pedro Melo wrote:
> Hi,
>
> I implementing a "on_field_change" hook. External classes can hook
> the DBIC model to observe (usually) status changes and start some
> business logic processes. The reason I choose this approach is that
> it creates a loosely coupled system, where I can add other components
> later without going back and modifying old code.
Hook how?
On a class base, a schema object base, a resultsource base, a resultset
base, a per-object base?
> From my first look through the code, I think the set_column() is the
> proper place to do this. But we could set_column() and then not update
> ().
Or store_column if you only want -actual- sets rather than "maybe a set"
(the value equality and dirty_columns logic is in set_)
> So update() and look at the dirty columns is probably safer.
>
> If I want to trigger on insert also, I also have to watch for insert().
Right.
> Another option is to create an InflateColumn::Trigger and use that,
> but it might not be what people expect.
No. You might like to have a look at the implementation of CDBICompat::Triggers
and consider doing something similar for Class::Observer rather than
Class::Trigger though.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
_______________________________________________
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]/