+++ /dev/null
-use strict;
-
-use Module::Build;
-
-my $build = Module::Build->new(
- module_name => 'DBIx::Class::DateTime::Epoch',
- dist_author => 'Brian Cassidy <bricas@cpan.org>',
- license => 'perl',
- create_readme => 1,
- create_makefile_pl => 'traditional',
- requires => {
- 'DateTime' => 0,
- 'DBIx::Class' => 0
- },
- build_requires => {
- 'Test::More' => 0
- },
-);
-
-$build->create_build_script;
--- /dev/null
+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;
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
use base qw( DBIx::Class );
=back
-=head1 AUTHOR
+=head1 AUTHORS
-=over 4
-
-=item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>
-
-=item * Adam Paynter E<lt>adapay@cpan.orgE<gt>
+Brian Cassidy E<lt>bricas@cpan.orgE<gt>
-=back
+Adam Paynter E<lt>adapay@cpan.orgE<gt>
=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 ) },
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 );
next if exists $dirty{ $column };
$self->set_column( $column => $time );
}
-
+
$self->next::method( @_ );
}