| Class-DBI-Plugin-TimePiece documentation | Contained in the Class-DBI-Plugin-TimePiece distribution. |
Class::DBI::Plugin::TimePiece - Extension to Class::DBI for DB date type.
This documentation refers to Class::DBI::Plugin::TimePiece version 0.01
__PACKAGE__->has_a_timepiece( INS_DATE => '%y/%m/%d %H:%M:%S' ); __PACKAGE__->has_a_tp( UPDATE_DATE => '%y/%m/%d %H:%M:%S' );
This module is Extensionto Class::DBI for DB date type.
This method relation to DB date type.
__PACKAGE__->has_a_timepiece( INS_DATE => '%y/%m/%d %H:%M:%S' );
has_a_tp is has_a_timepiece's alias.
__PACKAGE__->has_a_tp( UPDATE_DATE => '%y/%m/%d %H:%M:%S' );
Carp, Time::Piece
Carp, Time::Piece
There are no known bugs in this module. Please report problems to Atsushi Kobayashi (<nekokak@cpan.org>) Patches are welcome.
Atsushi Kobayashi, <nekokak@cpan.org>
Copyright (C) 2005 by Atsushi Kobayashi (<nekokak@cpan.org>). All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
| Class-DBI-Plugin-TimePiece documentation | Contained in the Class-DBI-Plugin-TimePiece distribution. |
package Class::DBI::Plugin::TimePiece; use strict; use warnings; use Carp; use vars '$VERSION'; $VERSION = '0.01'; sub import { my $class = shift; my $pkg = caller(0); no strict 'refs'; *{"$pkg\::has_a_timepiece"} = sub { my $self = shift; my $colum = shift; my $format = shift; $self->has_a( $colum => 'Time::Piece', inflate => sub { Time::Piece->strptime(shift , $format ) }, deflate => sub { shift->strftime($format) }, ); }; *{"$pkg\::has_a_tp"} = *{"$pkg\::has_a_timepiece"}; } 1; __END__