Interact/Role/FindMatch.pm

filter: Statementstmt 60.0% 9 / 15 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 1 totaltotal 45.8% 11 / 24 CC 3 SCAR 14.4
CC
3
Cov
47%
find_match
7.1
__ANON__
2.0
BEGIN
1.0
CRAP 4.2
« Interact/Transport/Wrapper/Net_Telnet.pm ↑ Summary Interact/Transport/Wrapper/IPC_Run.pm »
1 package Net::CLI::Interact::Role::FindMatch;
2 {
3 1 $Net::CLI::Interact::Role::FindMatch::VERSION = '2.143070';
4 }
5  
6 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # see if any regexp in the arrayref match the response
9 sub find_match {
10 0 ▶ my ($self, $text, $matches) = @_;
Subroutine find_match: not called CC=3 SCAR=19.6
Pod undocumented
11 0 ▶ $matches = ((ref $matches eq ref qr//) ? [$matches] : $matches);
Branch: 1 branch
BranchTrueFalseTotal
ref $matches eq ref qr// ? : 0 0 0
12 return undef unless
13 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
14  
15 1 ▶ use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 0 ▶ return first { $text =~ $_ } @$matches;
Subroutine __ANON__: not called CC=1 SCAR=6.9
17 }
18  
19  
20 1 1;
« Interact/Transport/Wrapper/Net_Telnet.pm ↑ Summary Interact/Transport/Wrapper/IPC_Run.pm »