| 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
| |||||||||||
| 9 | return unless | ||||||||||
| 10 | 0 | ▶ | (scalar grep {ref $_ eq ref qr//} @$matches) == scalar @$matches; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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; | |||||||||