| 1 | package Class::DBI::Plugin::TimePiece::Oracle; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Class::DBI::Plugin::DateFormat::Oracle; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # This module supports the following %FORMAT. | ||||||||||||||||||||||||||||
| 13 | 1 | 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 | 1 | my $SEPARATOR = q[\s\-\/\,\;\:]; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=2.4
| |||||||||||||||||||||||||||||
| 32 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 33 | 1 | my $pkg = caller(0); | |||||||||||||||||||||||||||
| 34 | 1 | my $format; | |||||||||||||||||||||||||||
| 35 | my $nsl_format; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 1 | ▶ | *{"$pkg\::has_a_auto_timepiece"} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=4.9
| |||||||||||||||||||||||||||||
| 39 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 40 | 0 | my $colum = shift; | |||||||||||||||||||||||||||
| 41 | 0 | $self->_get_nls_date_format; | |||||||||||||||||||||||||||
| 42 | $self->has_a( | ||||||||||||||||||||||||||||
| 43 | $colum => 'Time::Piece', | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | inflate => sub { Time::Piece->strptime(shift , $format ) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | deflate => sub { shift->strftime($format) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 46 | 0 | ); | |||||||||||||||||||||||||||
| 47 | 1 | }; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 1 | *{"$pkg\::has_a_atp"} = *{"$pkg\::has_a_auto_timepiece"}; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | ▶ | *{"$pkg\::_get_nls_date_format"} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=36.1
| |||||||||||||||||||||||||||||
| 52 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if ( defined $format ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | return; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ( ! defined $nsl_format ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | $nsl_format = $self->get_nls_date_format; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | my $chk_target = $nsl_format; | |||||||||||||||||||||||||||
| 63 | 0 | $format = $nsl_format; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | for my $key ( reverse sort keys %FORMAT ) { | |||||||||||||||||||||||||||
| 66 | 0 | $format =~ s/${key}/$FORMAT{$key}/; | |||||||||||||||||||||||||||
| 67 | 0 | $chk_target =~ s/${key}//; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | $self->_croak("FORMAT PARSE ERROR!") if ( $chk_target eq q[] && $chk_target =~ /[^${SEPARATOR}]/ ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$chk_target eq "" and $chk_target =~ /[^$SEPARATOR]/
MC/DC0%0/2
$chk_target eq "" and $chk_target =~ /[^$SEPARATOR]/
$chk_target eq ""
$chk_target =~ /[^$SEPARATOR]/
Truth table0%0/3
A and B
A= $chk_target eq ""B= $chk_target =~ /[^$SEPARATOR]/
| |||||||||||||||||||||||||||||
| 70 | 1 | }; | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 1 | goto &Class::DBI::Plugin::DateFormat::Oracle::import; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 1 | 1; | |||||||||||||||||||||||||||
| 76 | __END__ | ||||||||||||||||||||||||||||