[CDBI] after_set_$col and after_create

Perrin Harkins perrin at elem.com
Thu Oct 27 17:38:20 BST 2005

On Thu, 2005-10-27 at 09:15 -0400, Michael Peters wrote:
> But I'm still a little confused as to why the before_set_$column isn't
> working for you. It should be called both on update and insert. At least
> according to the docs for 3.0.1:
>    All triggers are passed the object they are being fired for, except
>    when before_set_$column is fired during "insert", in which case the
>    class is passed in place of the object, which does not yet exist. You
>    may change object values if required.
> So it does get called on insert, but you have to do a little bit of
> param investigation to determine if you actually have the object, or
> just a class and a hash of data.

It amounts to having to write two completely separate methods, since
most of the code is going to be handling the different ways of getting
the data.  That's what bothered me about it.  Class::DBI should be able
to offer a uniform API for transforming data on a column when it gets

- Perrin

More information about the ClassDBI mailing list