r37302 - in /branches/upstream/libdbix-class-datetime-epoch-perl/current: ./ lib/ lib/DBIx/ lib/DBIx/Class/ lib/DBIx/Class/DateTime/ t/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Tue Jun 2 17:52:56 UTC 2009
Author: gregoa
Date: Tue Jun 2 17:52:52 2009
New Revision: 37302
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37302
Log:
Load DBIx-Class-DateTime-Epoch-0.03 into
branches/upstream/libdbix-class-datetime-epoch-perl/current.
Added:
branches/upstream/libdbix-class-datetime-epoch-perl/current/Build.PL
branches/upstream/libdbix-class-datetime-epoch-perl/current/Changes
branches/upstream/libdbix-class-datetime-epoch-perl/current/MANIFEST
branches/upstream/libdbix-class-datetime-epoch-perl/current/META.yml
branches/upstream/libdbix-class-datetime-epoch-perl/current/Makefile.PL
branches/upstream/libdbix-class-datetime-epoch-perl/current/README
branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/
branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/
branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/
branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/DateTime/
branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/DateTime/Epoch.pm
branches/upstream/libdbix-class-datetime-epoch-perl/current/t/
branches/upstream/libdbix-class-datetime-epoch-perl/current/t/01-use.t
branches/upstream/libdbix-class-datetime-epoch-perl/current/t/98-pod_coverage.t
branches/upstream/libdbix-class-datetime-epoch-perl/current/t/99-pod.t
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/Build.PL?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/Build.PL (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/Build.PL Tue Jun 2 17:52:52 2009
@@ -1,0 +1,20 @@
+use strict;
+
+use Module::Build;
+
+my $build = Module::Build->new(
+ module_name => 'DBIx::Class::DateTime::Epoch',
+ dist_author => 'Brian Cassidy <bricas at 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;
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/Changes?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/Changes (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/Changes Tue Jun 2 17:52:52 2009
@@ -1,0 +1,10 @@
+Revision history for Perl extension DBIx::Class::DateTime::Epoch.
+
+0.03 Wed Apr 25 2007
+ - don't override user-supplied values for update()
+
+0.02 Mon Jul 17 2006
+ - Re-release onto CPAN
+
+0.01 Wed Mar 22 2006
+ - original version;
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/MANIFEST?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/MANIFEST (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/MANIFEST Tue Jun 2 17:52:52 2009
@@ -1,0 +1,10 @@
+Build.PL
+Changes
+lib/DBIx/Class/DateTime/Epoch.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/01-use.t
+t/98-pod_coverage.t
+t/99-pod.t
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/META.yml?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/META.yml (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/META.yml Tue Jun 2 17:52:52 2009
@@ -1,0 +1,22 @@
+---
+name: DBIx-Class-DateTime-Epoch
+version: 0.03
+author:
+ - 'Brian Cassidy <bricas at cpan.org>'
+abstract: Automatic inflation/deflation of epoch-based DateTime objects for DBIx::Class
+license: perl
+resources:
+ license: http://dev.perl.org/licenses/
+requires:
+ DBIx::Class: 0
+ DateTime: 0
+build_requires:
+ Test::More: 0
+provides:
+ DBIx::Class::DateTime::Epoch:
+ file: lib/DBIx/Class/DateTime/Epoch.pm
+ version: 0.03
+generated_by: Module::Build version 0.2807
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/Makefile.PL?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/Makefile.PL (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/Makefile.PL Tue Jun 2 17:52:52 2009
@@ -1,0 +1,16 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+ 'PL_FILES' => {},
+ 'INSTALLDIRS' => 'site',
+ 'NAME' => 'DBIx::Class::DateTime::Epoch',
+ 'EXE_FILES' => [],
+ 'VERSION_FROM' => 'lib/DBIx/Class/DateTime/Epoch.pm',
+ 'PREREQ_PM' => {
+ 'Test::More' => 0,
+ 'DateTime' => 0,
+ 'DBIx::Class' => 0
+ }
+ )
+;
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/README?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/README (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/README Tue Jun 2 17:52:52 2009
@@ -1,0 +1,68 @@
+NAME
+ DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of
+ epoch-based DateTime objects for DBIx::Class
+
+SYNOPSIS
+ package foo;
+
+ use base qw( DBIx::Class );
+
+ __PACKAGE__->load_components( qw( DateTime::Epoch Core ) );
+ __PACKAGE__->add_columns(
+ name => {
+ data_type => 'varchar',
+ size => 10
+ },
+ bar => {
+ data_type => 'bigint',
+ epoch => 1
+ },
+ creation_time => {
+ data_type => 'bigint',
+ epoch => 'ctime'
+ },
+ modification_time => {
+ data_type => 'bigint',
+ epoch => 'mtime'
+ }
+ );
+
+DESCRIPTION
+ This module automatically inflates/deflates DateTime objects
+ corresponding to applicable columns. Columns may also be defined to
+ specify their nature, such as columns representing a creation time (set
+ at time of insertion) or a modification time (set at time of every
+ update).
+
+METHODS
+ register_column
+ This method will automatically add inflation and deflation rules to a
+ column if an epoch value has been set in the column's definition. If the
+ epoch value is 'ctime' (creation time) or 'mtime' (modification time),
+ it will be registered as such for later use by the insert and the update
+ methods.
+
+ insert
+ This method will set the value of all registered creation time columns
+ to the current time. No changes will be made to a column whose value has
+ already been set.
+
+ update
+ This method will set the value of all registered modification time
+ columns to the current time. This will overwrite a column's value, even
+ if it has been already set.
+
+SEE ALSO
+ * DateTime
+ * DBIx::Class
+
+AUTHOR
+ * Brian Cassidy <bricas at cpan.org>
+ * Adam Paynter <adapay at cpan.org>
+
+COPYRIGHT AND LICENSE
+ Copyright 2006 by Brian Cassidy
+
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/DateTime/Epoch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/DateTime/Epoch.pm?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/DateTime/Epoch.pm (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/lib/DBIx/Class/DateTime/Epoch.pm Tue Jun 2 17:52:52 2009
@@ -1,0 +1,146 @@
+package DBIx::Class::DateTime::Epoch;
+
+use strict;
+use warnings;
+
+our $VERSION = '0.03';
+
+use base qw( DBIx::Class );
+
+use DateTime;
+
+=head1 NAME
+
+DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of epoch-based DateTime objects for DBIx::Class
+
+=head1 SYNOPSIS
+
+ package foo;
+
+ use base qw( DBIx::Class );
+
+ __PACKAGE__->load_components( qw( DateTime::Epoch Core ) );
+ __PACKAGE__->add_columns(
+ name => {
+ data_type => 'varchar',
+ size => 10
+ },
+ bar => {
+ data_type => 'bigint',
+ epoch => 1
+ },
+ creation_time => {
+ data_type => 'bigint',
+ epoch => 'ctime'
+ },
+ modification_time => {
+ data_type => 'bigint',
+ epoch => 'mtime'
+ }
+ );
+
+=head1 DESCRIPTION
+
+This module automatically inflates/deflates DateTime objects
+corresponding to applicable columns. Columns may also be
+defined to specify their nature, such as columns representing a
+creation time (set at time of insertion) or a modification time
+(set at time of every update).
+
+=head1 METHODS
+
+=head2 register_column
+
+This method will automatically add inflation and deflation rules
+to a column if an epoch value has been set in the column's definition.
+If the epoch value is 'ctime' (creation time) or 'mtime'
+(modification time), it will be registered as such for later
+use by the insert and the update methods.
+
+=head2 insert
+
+This method will set the value of all registered creation time
+columns to the current time. No changes will be made to a column
+whose value has already been set.
+
+=head2 update
+
+This method will set the value of all registered modification time
+columns to the current time. This will overwrite a column's value,
+even if it has been already set.
+
+=head1 SEE ALSO
+
+=over 4
+
+=item * DateTime
+
+=item * DBIx::Class
+
+=back
+
+=head1 AUTHOR
+
+=over 4
+
+=item * Brian Cassidy E<lt>bricas at cpan.orgE<gt>
+
+=item * Adam Paynter E<lt>adapay at cpan.orgE<gt>
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2006 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 => [ ] );
+
+sub register_column {
+ 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';
+
+ $class->inflate_column(
+ $col => {
+ inflate => sub { DateTime->from_epoch( epoch => shift ) },
+ deflate => sub { shift->epoch }
+ }
+ );
+ }
+}
+
+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 );
+ }
+
+ $self->next::method( @_ );
+}
+
+sub update {
+ my $self = shift;
+ my $time = time;
+ my %dirty = $self->get_dirty_columns;
+
+ for my $column ( @{ $self->mtime_columns } ) {
+ next if exists $dirty{ $column };
+ $self->set_column( $column => $time );
+ }
+
+ $self->next::method( @_ );
+}
+
+1;
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/t/01-use.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/t/01-use.t?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/t/01-use.t (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/t/01-use.t Tue Jun 2 17:52:52 2009
@@ -1,0 +1,5 @@
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'DBIx::Class::DateTime::Epoch' );
+}
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/t/98-pod_coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/t/98-pod_coverage.t?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/t/98-pod_coverage.t (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/t/98-pod_coverage.t Tue Jun 2 17:52:52 2009
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Added: branches/upstream/libdbix-class-datetime-epoch-perl/current/t/99-pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbix-class-datetime-epoch-perl/current/t/99-pod.t?rev=37302&op=file
==============================================================================
--- branches/upstream/libdbix-class-datetime-epoch-perl/current/t/99-pod.t (added)
+++ branches/upstream/libdbix-class-datetime-epoch-perl/current/t/99-pod.t Tue Jun 2 17:52:52 2009
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
More information about the Pkg-perl-cvs-commits
mailing list