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   1902 use v5.26;
  13         40  
3 13     13   61 use strict;
  13         18  
  13         350  
4 13     13   51 use warnings;
  13         16  
  13         2728  
5              
6 1     1 1 17 sub text { 'vacation' }
7 4     4 0 16 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 43     43 1 77 my $class = shift;
15 43   100     138 my $argv1 = shift // return 0;
16              
17 42         61 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 42 50       89 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  168         367  
24 42         114 return 0;
25             }
26 1     1 0 5 sub true { return 0 }
27             1;
28              
29             __END__