/me wrote:
> Wouldn't it be better if $self->is_changed is consulted first in
> DBIx::Class::TimeStamp?
I took DBIx::Class::TimeStamp version 0.05 (the one w/o DynamicDefault)
and modified the code to DWIM:
sub update {
my ($self, $upd) = @_;
# needed to get_dirty_columns()
$self->set_inflated_columns($upd) if $upd;
my %dirty = $self->get_dirty_columns();
if (%dirty) {
my $now = $self->get_timestamp();
my @columns = @{ $self->__column_timestamp_triggers()->{on_update} };
foreach my $column ( @columns ) {
next if exists $dirty{ $column };
my $accessor = $self->column_info($column)->{accessor} || $column;
$self->$accessor($now);
}
}
$self->next::method;
}
Even if it seems to work correctly, I'm still not really happy with it,
because it copies some innards of DBIx::Class::Row::update(), so I'm not
sure if it really behaves right in every case and in future versions of
DBIC.
--
Bernhard Graf
_______________________________________________
List: http://lists.scsys.co.uk/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://www.grokbase.com/group/[EMAIL PROTECTED]