| 1 | package App::Reg; | ||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | # Import re, but without warnings about empty list | ||||||||||
| 6 | 6 | ▶ | use re (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 6 | our $VERSION = '1.2.5'; | |||||||||
| 9 | 6 | our @EXPORT = our @EXPORT_OK = 'reg'; | |||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | sub reg { | ||||||||
|
Subroutine
reg: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||
| 12 | 2 | my ($string, $pattern, %options) = @_; | |||||||||
| 13 | |||||||||||
| 14 | # works like use, but it isn't done at compile time | ||||||||||
| 15 | 2 | ▶ | re->import('eval', $options{color} ? 'debugcolor' : 'debug'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | # Check if multiple matches are requested | ||||||||||
| 18 | 2 | ▶ | if ($options{global}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | # Saved in variable, so it wouldn't depend on wantarray() | ||||||||||
| 20 | 0 | my @output = $string =~ /$pattern/g; | |||||||||
| 21 | 0 | return @output; | |||||||||
| 22 | } | ||||||||||
| 23 | else { | ||||||||||
| 24 | 2 | return $string =~ /$pattern/; | |||||||||
| 25 | } | ||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | # Return positive value | ||||||||||
| 29 | 6 | 1; | |||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||