| 1 | package Petal::Utils::US_Date; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use warnings::register; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 2 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 2 | ▶ | use base qw( Petal::Utils::Base ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 2 | ▶ | use constant name => 'us_date'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 2 | ▶ | use constant aliases => qw(); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | 2 | our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1]; | |||||||||||
| 14 | 2 | our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2]; | |||||||||||
| 15 | |||||||||||||
| 16 | 4 | ▶ | sub process { | ||||||||||
|
Subroutine
process: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 17 | 4 | my $class = shift; | |||||||||||
| 18 | 4 | my $hash = shift; | |||||||||||
| 19 | 4 | ▶ | my $args = shift || confess( "'us_date' expects a variable (got nothing)!" ); | ||||||||||
|
Condition50%1/2
shift() || confess(q['us_date' expects a variable (got nothing)!])
MC/DC0%0/1
shift() || confess(q['us_date' expects a variable (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 20 | |||||||||||||
| 21 | 4 | my ($year,$mon,$day); | |||||||||||
| 22 | 4 | my ($date, $sep) = $hash->fetch($args); | |||||||||||
| 23 | 4 | ▶ | $sep ||= '/'; | ||||||||||
|
Condition50%1/2
$sep ||= "/"
MC/DC0%0/1
$sep ||= "/"
$sep
Truth table50%1/2
A
A= $sep
| |||||||||||||
| 24 | 4 | ▶ | if ($date =~ /[-|\/]/) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | 2 | ($year,$mon,$day) = split(/[-|\/]/, $date); | |||||||||||
| 26 | } | ||||||||||||
| 27 | else { | ||||||||||||
| 28 | 2 | ($year,$mon,$day) = $date =~ /(\d{4})(\d{2})(\d{2})/; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 4 | return sprintf("%02d$sep%02d$sep%04d", $mon,$day,$year); | |||||||||||
| 32 | } | ||||||||||||
| 33 | |||||||||||||
| 34 | 2 | 1; | |||||||||||
| 35 | |||||||||||||
| 36 | __END__ | ||||||||||||