lib/Lingy/Lang/Regex.pm

filter: Statementstmt 59.3% 19 / 32 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 4 totaltotal 48.0% 25 / 52 CC 4 SCAR 16.1
CC
4
Cov
50%
find
13.3
new
2.0
matches
2.0
CRAP 5.0
« lib/Lingy/Lang/Number.pm ↑ Summary lib/Lingy/Lang/Class.pm »
1 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Lingy::Lang::Regex;
3  
4 1 ▶use Lingy::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base SCALARTYPE;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use constant NAME => 'lingy.lang.Regex';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # need these things:
10 # * if-some
11 # * "sequence destructuring bindings"
12  
13 sub new {
14 0 ▶ my ($class, $scalar) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
15 0 bless qr/$scalar/, $class;
16 }
17  
18 sub find {
19 0 ▶ return nil unless $_[1] =~ $_[0];
Subroutine find: not called CC=4 SCAR=25.8
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
unless $_[1] =~ /$_[0]/ 0 0 0
20 0 ▶ return string($&) unless defined $1;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $1 0 0 0
21 0 my ($i, @capture) = (1, string($&));
22 {
23 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
24 0 ▶ while (defined (my $value = ${"$i"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $value = ${"$i";})) 0 0 0
25 0 push @capture, string($value);
26 0 $i++;
27 }
28 }
29 0 VECTOR->new([@capture]);
30 }
31  
32 sub matches {
33 0 ▶ find REGEX->new("\\A$_[0]\\z"), $_[1];
Subroutine matches: not called CC=1 SCAR=6.9
Pod undocumented
34 }
35  
36 sub pattern {
37 0 ▶ __PACKAGE__->new(@_);
Subroutine pattern: not called CC=1 SCAR=6.9
Pod undocumented
38 }
39  
40 1 1;
« lib/Lingy/Lang/Number.pm ↑ Summary lib/Lingy/Lang/Class.pm »