Flow/Result.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 100% 1 / 1 totaltotal 94.5% 35 / 37 CC 1 SCAR 0.0
CC
1
Cov
96%
BEGIN
1.0
__ANON__
1.0
BEGIN
1.0
CRAP 1.0
« Flow/Results.pm ↑ Summary
1 package Regexp::Flow::Result;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Regexp::Flow::Result - container for information about a Regexp match.
10  
11 =head1 DESCRIPTION
12  
13 This is a subclass of C<Regexp::Result>. It adds methods and attributes
14 which are useful to have in the same object.
15  
16 =cut
17  
18 1 extends 'Regexp::Result';
19  
20 =head1 OVERLOADING
21  
22 In a boolean context, this returns true if the match was a success.
23  
24 =cut
25  
26 use overload
27 0 ▶ '0+'=>sub{shift->success}; #~ for some reason \&success does not work here
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
28  
29 =head1 METHODS
30  
31 =head3 success
32  
33 C<1> or C<0>; default C<undef>. Indicates if the match was a success.
34  
35 =cut
36  
37 has success => (
38 is => 'rw',
39 13 ▶ default => sub{ undef },
Subroutine __ANON__: called CC=1 SCAR=0.0
40 1 );
41  
42 =head3 continue_action
43  
44 C<next> or C<last>; default C<next>. Used to control if C<m//g> and
45 C<s///g> continue to operate. See the C<last> method.
46  
47 =cut
48  
49 has continue_action => (
50 is => 'rw',
51 13 ▶ default => sub{'next'},
Subroutine __ANON__: called CC=1 SCAR=0.0
52 1 );
53  
54 =head3 last
55  
56 Invoke this method to set C<continue_action> to C<"last">. This
57 prevents further coderefs being executed by
58 C<Regexp::Flow::re_matches> or C<Regexp::Flow::re_substitutions>.
59 Note that this does not exit the current subroutine.
60  
61 =cut
62  
63 3 ▶sub last {
Subroutine last: called CC=1 SCAR=0.0
Pod documented
64 3 my $self = shift;
65 3 $self->continue_action('last');
66 3 return $self;
67 }
68  
69 =head3 string
70  
71 The string before the regexp was executed. Note that when globally
72 matching, the string is the same for all results - the string is only
73 changed when all the matches have been found.
74  
75 =cut
76  
77 has string => (
78 is => 'rw',
79 13 ▶ default => sub{ undef },
Subroutine __ANON__: called CC=1 SCAR=0.0
80 1 );
81  
82 =head3 re
83  
84 The regular expression in use.
85  
86 =cut
87  
88 has re => (
89 is => 'rw',
90 13 ▶ default => sub{ undef },
Subroutine __ANON__: called CC=1 SCAR=0.0
91 1 );
92  
93 =head1 SEE ALSO
94  
95 Regexp::Flow - which uses this module
96 (also for author and copyright information)
97  
98 =cut
99  
100 1 1;
« Flow/Results.pm ↑ Summary