Any thoughts? 2009/7/31 Oleg Kostyuk <[email protected]>: > Hello guys, > > I'm look at this part of DBIx/Class/TimeStamp.pm : > > ===== cut ===== > sub add_columns { > my ($self, @cols) = @_; > my @columns; > > while (my $col = shift @cols) { > my $info = ref $cols[0] ? shift @cols : {}; > > if ( delete $info->{set_on_create} ) { > $info->{dynamic_default_on_create} = 'get_timestamp'; > } > > if ( delete $info->{set_on_update} ) { > $info->{dynamic_default_on_update} = 'get_timestamp'; # !!! (1) > > if ( defined $info->{dynamic_default_on_create} and > $info->{dynamic_default_on_create} eq 'get_timestamp' > ) { > $info->{dynamic_default_on_update} = 'get_timestamp'; # !!! > (2) > } > } > > push @columns, $col => $info; > } > > return $self->next::method(@columns); > } > ===== cut ===== > > And can't understood, why we need (2), if we already did exactly same thing > in (1) ? > May be, there is some error? > > > As for me, following code have more sence: > > ===== cut ===== > if ( delete $info->{set_on_update} ) { > $info->{dynamic_default_on_update} = 'get_timestamp'; > > unless ( defined $info->{dynamic_default_on_create} and > $info->{dynamic_default_on_create} eq 'get_timestamp' > ) { > $info->{dynamic_default_on_create} = 'get_timestamp'; > } > } > ===== cut ===== > > > I'm using: > > % pmvers DBIx::Class > 0.08108 > > Could anyone explain me, what going on here? > Thanks in advance. >
-- Sincerely yours, Oleg Kostyuk (CUB-UANIC) _______________________________________________ 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]
