line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::DBI::Plugin::TimePiece::Oracle; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
32352
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
118
|
|
6
|
1
|
|
|
1
|
|
912
|
use Class::DBI::Plugin::DateFormat::Oracle; |
|
1
|
|
|
|
|
457
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
45
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
110
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.01'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# This module supports the following %FORMAT. |
13
|
|
|
|
|
|
|
my %FORMAT = ( |
14
|
|
|
|
|
|
|
'YYYY' => '%Y', |
15
|
|
|
|
|
|
|
'YY' => '%y', |
16
|
|
|
|
|
|
|
'RRRR' => '%Y', |
17
|
|
|
|
|
|
|
'RR' => '%y', |
18
|
|
|
|
|
|
|
'MM' => '%m', |
19
|
|
|
|
|
|
|
'MON' => '%b', |
20
|
|
|
|
|
|
|
'MONTH' => '%B', |
21
|
|
|
|
|
|
|
'DD' => '%d', |
22
|
|
|
|
|
|
|
'HH' => '%I', |
23
|
|
|
|
|
|
|
'HH24' => '%H', |
24
|
|
|
|
|
|
|
'MI' => '%M', |
25
|
|
|
|
|
|
|
'SS' => '%S', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# This module supports the following $SEPARATOR. |
29
|
|
|
|
|
|
|
my $SEPARATOR = q[\s\-\/\,\;\:]; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub import { |
32
|
1
|
|
|
1
|
|
11
|
my $class = shift; |
33
|
1
|
|
|
|
|
2
|
my $pkg = caller(0); |
34
|
1
|
|
|
|
|
2
|
my $format; |
35
|
|
|
|
|
|
|
my $nsl_format; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
353
|
|
38
|
1
|
|
|
|
|
7
|
*{"$pkg\::has_a_auto_timepiece"} = sub { |
39
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
40
|
0
|
|
|
|
|
0
|
my $colum = shift; |
41
|
0
|
|
|
|
|
0
|
$self->_get_nls_date_format; |
42
|
|
|
|
|
|
|
$self->has_a( |
43
|
|
|
|
|
|
|
$colum => 'Time::Piece', |
44
|
0
|
|
|
0
|
|
0
|
inflate => sub { Time::Piece->strptime(shift , $format ) }, |
45
|
0
|
|
|
0
|
|
0
|
deflate => sub { shift->strftime($format) }, |
46
|
0
|
|
|
|
|
0
|
); |
47
|
1
|
|
|
|
|
4
|
}; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
2
|
*{"$pkg\::has_a_atp"} = *{"$pkg\::has_a_auto_timepiece"}; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
5
|
|
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
5
|
*{"$pkg\::_get_nls_date_format"} = sub { |
52
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
0
|
if ( defined $format ) { |
55
|
0
|
|
|
|
|
0
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
0
|
if ( ! defined $nsl_format ) { |
59
|
0
|
|
|
|
|
0
|
$nsl_format = $self->get_nls_date_format; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
my $chk_target = $nsl_format; |
63
|
0
|
|
|
|
|
0
|
$format = $nsl_format; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
for my $key ( reverse sort keys %FORMAT ) { |
66
|
0
|
|
|
|
|
0
|
$format =~ s/${key}/$FORMAT{$key}/; |
67
|
0
|
|
|
|
|
0
|
$chk_target =~ s/${key}//; |
68
|
|
|
|
|
|
|
} |
69
|
0
|
0
|
0
|
|
|
0
|
$self->_croak("FORMAT PARSE ERROR!") if ( $chk_target eq q[] && $chk_target =~ /[^${SEPARATOR}]/ ); |
70
|
1
|
|
|
|
|
4
|
}; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
6
|
goto &Class::DBI::Plugin::DateFormat::Oracle::import; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |