[Bast-commits] r4819 -
DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Thu Sep 18 18:12:05 BST 2008
Author: rafl
Date: 2008-09-18 18:12:05 +0100 (Thu, 18 Sep 2008)
New Revision: 4819
Modified:
DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
Log:
Build triggers as a hash instead of an array.
Modified: DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm 2008-09-18 17:11:32 UTC (rev 4818)
+++ DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm 2008-09-18 17:12:05 UTC (rev 4819)
@@ -56,7 +56,7 @@
$self->next::method(@_);
- my %triggers = map { $_ => [] } qw/update create/;
+ my %triggers = map { $_ => {} } qw/update create/;
for my $column ($self->columns) {
my $info = $self->column_info($column);
@@ -65,17 +65,17 @@
for my $op (qw/update create/) {
my $meth = $info->{ "dynamic_default_on_${op}" };
- push @{ $triggers{$op} }, [$column => sub {
+ $triggers{$op}->{$column} = [$column => sub {
my $row = shift;
$row->$accessor( $row->$meth );
}, $op eq 'update' ? ($info->{always_update} || 0) : ()] if $meth;
}
}
- if (map { @{ $triggers{$_} } } qw/update create/) {
+ if (map { keys %{ $triggers{$_} } } qw/update create/) {
$self->__column_dynamic_default_triggers({
- on_update => [sort { $b->[2] <=> $a->[2] } @{ $triggers{update} }],
- on_create => $triggers{create},
+ on_update => [sort { $b->[2] <=> $a->[2] } values %{ $triggers{update} }],
+ on_create => [values %{ $triggers{create} }],
});
}
}
More information about the Bast-commits
mailing list