Hello guys,

I'm looking 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: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to