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 1     1   2771 use 5.010001;
  1         4  
4 1     1   5 use strict;
  1         2  
  1         22  
5 1     1   5 use warnings;
  1         2  
  1         40  
6              
7 1     1   7 use Date::Calc qw(Week_of_Year);
  1         2  
  1         210  
8              
9             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10             our $DATE = '2022-12-12'; # DATE
11             our $DIST = 'SQL-Statement-Functions-Date'; # DIST
12             our $VERSION = '0.050'; # VERSION
13              
14             sub SQL_FUNCTION_WEEKOFYEAR {
15 4     4 0 18 my $param = $_[2];
16 4 100       26 $param =~ /\A(\d{4})-(\d{2})-(\d{2})/ or return undef; ## no critic: TestingAndDebugging::ProhibitExplicitReturnUndef
17 3         20 my ($woyear, $year) = Week_of_Year($1, $2, $3);
18 3         14 $woyear;
19             }
20              
21             1;
22             # ABSTRACT: Return week of the year from a date/datetime expression
23              
24             __END__