File Coverage

blib/lib/SQL/Statement/Function/ByName/WEEKDAY.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 21 22 95.4


line stmt bran cond sub pod time code
1             package SQL::Statement::Function::ByName::WEEKDAY;
2              
3 1     1   2906 use 5.010001;
  1         4  
4 1     1   8 use strict;
  1         2  
  1         23  
5 1     1   5 use warnings;
  1         2  
  1         29  
6              
7 1     1   6 use Date::Calc qw(Day_of_Week);
  1         2  
  1         212  
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_WEEKDAY {
15 4     4 0 18 my $param = $_[2];
16 4 100       24 $param =~ /\A(\d{4})-(\d{2})-(\d{2})/ or return undef; ## no critic: TestingAndDebugging::ProhibitExplicitReturnUndef
17 3         26 Day_of_Week($1, $2, $3) - 1;
18             }
19              
20             1;
21             # ABSTRACT: WEEKDAY() SQL function
22              
23             __END__