[Dbix-class] applying row level methods via Schema::Loader

apv apv at sedition.com
Wed Jul 4 02:31:21 GMT 2007

I never got around to trying Schema::Loader till now. It's terrific.  
I swapped out 10 table classes or whatever with one and it works  
exactly as it should.

The thing I want to still be able to do is apply a method to all the  
table classes, specifically a created field stamp of NOW(). I'm on an  
older mysql for this project so I can't use triggers. There are dates  
before the epoch so I'm using DATETIME. This is what I want to do--

sub new {
     my ( $class, $attrs ) = @_;
     $attrs->{created} = \"NOW()" unless $attrs->{created};

Is there a way to get that in all the auto-generated table classes  
without voodoo? With? Better idea?


More information about the Dbix-class mailing list