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