1DBIx::Class::DateTime::UEspeorchC(o3n)tributed Perl DocuDmBeInxt:a:tCiloanss::DateTime::Epoch(3)
2
3
4

NAME

6       DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of
7       epoch-based columns to/from DateTime objects
8

SYNOPSIS

10           package MySchema::Foo;
11
12           use base qw( DBIx::Class );
13
14           __PACKAGE__->load_components( qw( DateTime::Epoch TimeStamp Core ) );
15           __PACKAGE__->add_columns(
16               name => {
17                   data_type => 'varchar',
18                   size      => 10,
19               },
20               bar => { # epoch stored as an int
21                   data_type        => 'bigint',
22                   inflate_datetime => 1,
23               },
24               baz => { # epoch stored as a string
25                   data_type        => 'varchar',
26                   size             => 50,
27                   inflate_datetime => 'epoch',
28               },
29               # working in conjunction with DBIx::Class::TimeStamp
30               creation_time => {
31                   data_type        => 'bigint',
32                   inflate_datetime => 1,
33                   set_on_create    => 1,
34               },
35               modification_time => {
36                   data_type        => 'bigint',
37                   inflate_datetime => 1,
38                   set_on_create    => 1,
39                   set_on_update    => 1,
40               }
41           );
42

DESCRIPTION

44       This module automatically inflates/deflates DateTime objects from/to
45       epoch values for the specified columns. This module is essentially an
46       extension to DBIx::Class::InflateColumn::DateTime so all of the
47       settings, including "locale" and "timezone", are also valid.
48
49       A column will be recognized as an epoch time given one of the following
50       scenarios:
51
52       ·   "data_type" is an "int" of some sort and "inflate_datetime" is also
53           set to a true value
54
55       ·   "data_type" is some other value (e.g. "varchar") and
56           "inflate_datetime" is explicitly set to "epoch".
57
58       DBIx::Class::TimeStamp can also be used in conjunction with this module
59       to support epoch-based columns that are automatically set on creation
60       of a row and updated subsequent modifications.
61

METHODS

63   add_columns( )
64       Provides backwards compatibility with the older DateTime::Epoch API.
65
66   _inflate_to_datetime( )
67       Overrides column inflation to use "Datetime->from_epoch".
68
69   _deflate_from_datetime( )
70       Overrides column deflation to call "epoch()" on the column value.
71

SEE ALSO

73       ·   DBIx::Class
74
75       ·   DBIx::Class::TimeStamp
76
77       ·   DateTime
78

AUTHORS

80       Brian Cassidy <bricas@cpan.org>
81
82       Adam Paynter <adapay@cpan.org>
83
85       Copyright 2006-2011 by Brian Cassidy
86
87       This library is free software; you can redistribute it and/or modify it
88       under the same terms as Perl itself.
89
90
91
92perl v5.12.3                      2011-01-18   DBIx::Class::DateTime::Epoch(3)
Impressum