blib/lib/App/Reg.pm

filter: Statementstmt 90.4% 19 / 21 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 87.1% 27 / 31 CC 3 SCAR 7.4
CC
3
Cov
84%
reg
3.6
BEGIN
1.0
BEGIN
1.0
CRAP 2.1
↑ Summary bin/reg »
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
BranchTrueFalseTotal
$options{'color'} ? : 2 0 2
16  
17 # Check if multiple matches are requested
18 2 ▶ if ($options{global}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options{'global'}) { } 0 2 2
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__
↑ Summary bin/reg »