Changeset 22312 for lang/perl/DBIx-Class-TimeStamp-Auto
- Timestamp:
- 10/29/08 14:15:07 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/DBIx-Class-TimeStamp-Auto/lib/DBIx/Class/TimeStamp/Auto.pm
r21707 r22312 1 1 package DBIx::Class::TimeStamp::Auto; 2 3 2 use strict; 4 3 use warnings; … … 34 33 __PACKAGE__->mk_classdata(timestamp_class => 'DBIx::Class::TimeStamp::Auto'); 35 34 36 before create => sub {37 my ($self, $attrs) = @_;38 39 return if ref $attrs ne 'HASH';40 41 my $now;42 my $timestamp_class = $self->timestamp_class;43 44 for (45 @{$timestamp_class->auto_create_datetime_columns},46 @{$timestamp_class->auto_update_datetime_columns}47 ) {48 $attrs->{$_} = $now ||= $timestamp_class->get_current_datetime49 if !defined $attrs->{$_} and $self->is_inflate_datetime_column($_);50 }51 };52 53 35 before update => sub { 54 36 my ($self, $attrs) = @_; … … 59 41 my $timestamp_class = $self->timestamp_class; 60 42 61 for ( 62 @{$timestamp_class->auto_update_datetime_columns} 63 ) { 43 for (@{$timestamp_class->auto_update_datetime_columns}) { 64 44 $attrs->{$_} = $now ||= $timestamp_class->get_current_datetime 65 45 if !defined $attrs->{$_} and $self->is_inflate_datetime_column($_);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)