Newer Older
52 lines | 1.102kb
packing
yuki-kimoto authored on 2009-11-12
1
package DBIx::Custom::Basic;
2
use base 'DBIx::Custom';
3
use Encode qw/decode encode/;
4

            
5
use warnings;
6
use strict;
7

            
8
our $VERSION = '0.0101';
9

            
10
my $class = __PACKAGE__;
11

            
12
$class->add_filter(
13
    default_bind_filter  => sub { encode('UTF-8', $_[1]) },
14
    default_fetch_filter => sub { decode('UTF-8', $_[1]) }
15
);
16

            
17
$class->bind_filter($class->filters->{default_bind_filter});
18
$class->fetch_filter($class->filters->{default_fetch_filter});
19

            
20
$class->add_format(
21
    'SQL99_date'        => '%Y-%m-%d',
22
    'SQL99_datetime'    => '%Y-%m-%d %H:%M:%S',
23
    'SQL99_time'        => '%H:%M:%S',
24
    'ISO-8601_date'     => '%Y-%m-%d',
25
    'ISO-8601_datetime' => '%Y-%m-%dT%H:%M:%S',
26
    'ISO-8601_time'     => '%H:%M:%S',
27
);
28

            
29
1;
30

            
31
=head1 NAME
32

            
33
DBIx::Custom::Basic - DBIx::Custom basic class
34

            
35
=head1 VERSION
36

            
37
Version 0.0101
38

            
39
=head1 AUTHOR
40

            
41
Yuki Kimoto, C<< <kimoto.yuki at gmail.com> >>
42

            
43
Github L<http://github.com/yuki-kimoto>
44

            
45
=head1 COPYRIGHT & LICENSE
46

            
47
Copyright 2009 Yuki Kimoto, all rights reserved.
48

            
49
This program is free software; you can redistribute it and/or modify it
50
under the same terms as Perl itself.
51

            
52
=cut