File Coverage

blib/lib/SQL/Statement/Function/ByName/WEEKOFYEAR.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package SQL::Statement::Function::ByName::WEEKOFYEAR;
2              
3             our $DATE = '2016-01-21'; # DATE
4             our $VERSION = '0.03'; # VERSION
5              
6 1     1   1901 use 5.010001;
  1         3  
7 1     1   7 use strict;
  1         3  
  1         28  
8 1     1   7 use warnings;
  1         2  
  1         32  
9              
10 1     1   5 use Date::Calc qw(Week_of_Year);
  1         2  
  1         150  
11              
12             sub SQL_FUNCTION_WEEKOFYEAR {
13 3     3 0 14 my $param = $_[2];
14 3 100       22 $param =~ /\A(\d{4})-(\d{2})-(\d{2})/ or return undef;
15 2         10 my ($woyear, $year) = Week_of_Year($1, $2, $3);
16 2         7 $woyear;
17             }
18              
19             1;
20             # ABSTRACT: WEEKOFYEAR() SQL function
21              
22             __END__