From: Brian Cassidy Date: Tue, 30 Oct 2007 18:00:12 +0000 (+0000) Subject: switch to module::install, perltidy X-Git-Tag: 0.04~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a389a2c7e26f2bc44ff5518acda959f29205885;p=dbsrgits%2FDBIx-Class-DateTime-Epoch.git switch to module::install, perltidy --- diff --git a/Build.PL b/Build.PL deleted file mode 100644 index 86daf7d..0000000 --- a/Build.PL +++ /dev/null @@ -1,20 +0,0 @@ -use strict; - -use Module::Build; - -my $build = Module::Build->new( - module_name => 'DBIx::Class::DateTime::Epoch', - dist_author => 'Brian Cassidy ', - license => 'perl', - create_readme => 1, - create_makefile_pl => 'traditional', - requires => { - 'DateTime' => 0, - 'DBIx::Class' => 0 - }, - build_requires => { - 'Test::More' => 0 - }, -); - -$build->create_build_script; diff --git a/Changes b/Changes index bda906c..9439089 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::Class::DateTime::Epoch. +0.04 Tue Oct 30 2007 + - switch to Module::Install + 0.03 Wed Apr 25 2007 - don't override user-supplied values for update() diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..4eecfc4 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,16 @@ +use inc::Module::Install 0.67; + +if( -e 'MANIFEST.SKIP' ) { + system( 'pod2text lib/DBIx/Class/DateTime/Epoch.pm > README' ); +} + +name 'DBIx-Class-DateTime-Epoch'; +all_from 'lib/DBIx/Class/DateTime/Epoch.pm'; + +requires 'DBIx::Class'; +requires 'DateTime'; + +test_requires 'Test::More'; + +auto_install; +WriteAll; diff --git a/lib/DBIx/Class/DateTime/Epoch.pm b/lib/DBIx/Class/DateTime/Epoch.pm index 395fe94..f0f74b3 100644 --- a/lib/DBIx/Class/DateTime/Epoch.pm +++ b/lib/DBIx/Class/DateTime/Epoch.pm @@ -3,7 +3,7 @@ package DBIx::Class::DateTime::Epoch; use strict; use warnings; -our $VERSION = '0.03'; +our $VERSION = '0.04'; use base qw( DBIx::Class ); @@ -79,36 +79,34 @@ even if it has been already set. =back -=head1 AUTHOR +=head1 AUTHORS -=over 4 - -=item * Brian Cassidy Ebricas@cpan.orgE - -=item * Adam Paynter Eadapay@cpan.orgE +Brian Cassidy Ebricas@cpan.orgE -=back +Adam Paynter Eadapay@cpan.orgE =head1 COPYRIGHT AND LICENSE -Copyright 2006 by Brian Cassidy +Copyright 2007 by Brian Cassidy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut -__PACKAGE__->mk_classdata( ctime_columns => [ ] ); -__PACKAGE__->mk_classdata( mtime_columns => [ ] ); +__PACKAGE__->mk_classdata( ctime_columns => [] ); +__PACKAGE__->mk_classdata( mtime_columns => [] ); sub register_column { - my( $class, $col, $info ) = @_; + my ( $class, $col, $info ) = @_; $class->next::method( $col, $info ); - - if( my $type = $info->{ epoch } ) { - $class->ctime_columns( [ @{ $class->ctime_columns }, $col ] ) if $type eq 'ctime'; - $class->mtime_columns( [ @{ $class->mtime_columns }, $col ] ) if $type eq 'mtime'; - + + if ( my $type = $info->{ epoch } ) { + $class->ctime_columns( [ @{ $class->ctime_columns }, $col ] ) + if $type eq 'ctime'; + $class->mtime_columns( [ @{ $class->mtime_columns }, $col ] ) + if $type eq 'mtime'; + $class->inflate_column( $col => { inflate => sub { DateTime->from_epoch( epoch => shift ) }, @@ -121,7 +119,7 @@ sub register_column { sub insert { my $self = shift; my $time = time; - + for my $column ( @{ $self->ctime_columns }, @{ $self->mtime_columns } ) { next if defined $self->get_column( $column ); $self->store_column( $column => $time ); @@ -139,7 +137,7 @@ sub update { next if exists $dirty{ $column }; $self->set_column( $column => $time ); } - + $self->next::method( @_ ); }