File Coverage

lib/Sisimai/Reason/Vacation.pm
Criterion Covered Total %
statement 17 17 100.0
branch 1 2 50.0
condition 2 2 100.0
subroutine 7 7 100.0
pod 2 4 50.0
total 29 32 90.6


line stmt bran cond sub pod time code
1             package Sisimai::Reason::Vacation;
2 13     13   2000 use v5.26;
  13         51  
3 13     13   76 use strict;
  13         21  
  13         409  
4 13     13   62 use warnings;
  13         33  
  13         2961  
5              
6 1     1 1 18 sub text { 'vacation' }
7 4     4 0 13 sub description { 'Email replied automatically due to a recipient is out of office' }
8             sub match {
9             # Try to match that the given text and regular expressions
10             # @param [String] argv1 String to be matched with regular expressions
11             # @return [Integer] 0: Did not match
12             # 1: Matched
13             # @since v4.22.3
14 38     38 1 108 my $class = shift;
15 38   100     197 my $argv1 = shift // return 0;
16              
17 37         75 state $index = [
18             'i am away on vacation',
19             'i am away until',
20             'i am out of the office',
21             'i will be traveling for work on',
22             ];
23 37 50       87 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  148         358  
24 37         155 return 0;
25             }
26 1     1 0 4 sub true { return 0 }
27             1;
28              
29             __END__