Interact/Role/FindMatch.pm

filter: Statementstmt 57.1% 8 / 14 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 1 totaltotal 43.4% 10 / 23 CC 3 SCAR 14.4
CC
3
Cov
44%
find_match
7.1
__ANON__
2.0
BEGIN
1.0
CRAP 4.2
« Interact/Transport/Serial.pm ↑ Summary Interact.pm »
1 package Net::CLI::Interact::Role::FindMatch;
2 5 $Net::CLI::Interact::Role::FindMatch::VERSION = '2.400001';
3 5 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # see if any regexp in the arrayref match the response
6 sub find_match {
7 0 ▶ my ($self, $text, $matches) = @_;
Subroutine find_match: not called CC=3 SCAR=19.6
Pod undocumented
8 0 ▶ $matches = ((ref $matches eq ref qr//) ? [$matches] : $matches);
Branch: 1 branch
BranchTrueFalseTotal
ref $matches eq ref qr// ? : 0 0 0
9 return unless
10 0 ▶ (scalar grep {ref $_ eq ref qr//} @$matches) == scalar @$matches;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar grep({ref $_ eq ref qr//;} @$matches) == scalar @$matches 0 0 0
11  
12 5 ▶ use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 0 ▶ return first { $text =~ $_ } @$matches;
Subroutine __ANON__: not called CC=1 SCAR=6.9
14 }
15  
16 =pod
17  
18 =for Pod::Coverage find_match
19  
20 =cut
21  
22 5 1;
« Interact/Transport/Serial.pm ↑ Summary Interact.pm »