← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:13 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Structure/Main.pm
StatementsExecuted 8 statements in 176µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112µs23µsPPIx::Regexp::Structure::Main::::BEGIN@38PPIx::Regexp::Structure::Main::BEGIN@38
1117µs11µsPPIx::Regexp::Structure::Main::::BEGIN@39PPIx::Regexp::Structure::Main::BEGIN@39
1117µs57µsPPIx::Regexp::Structure::Main::::BEGIN@41PPIx::Regexp::Structure::Main::BEGIN@41
0000s0sPPIx::Regexp::Structure::Main::::delimitersPPIx::Regexp::Structure::Main::delimiters
0000s0sPPIx::Regexp::Structure::Main::::interpolatesPPIx::Regexp::Structure::Main::interpolates
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1=head1 NAME
2
3PPIx::Regexp::Structure::Main - Represent a regular expression proper, or a substitution
4
5=head1 SYNOPSIS
6
7 use PPIx::Regexp::Dumper;
8 PPIx::Regexp::Dumper->new( 'qr{foo}smx' )
9 ->print();
10
11=head1 INHERITANCE
12
13C<PPIx::Regexp::Structure::Main> is a
14L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>.
15
16C<PPIx::Regexp::Structure::Main> is the parent of
17L<PPIx::Regexp::Structure::Regexp|PPIx::Regexp::Structure::Regexp> and
18L<PPIx::Regexp::Structure::Replacement|PPIx::Regexp::Structure::Replacement>.
19
20=head1 DESCRIPTION
21
22This abstract class represents one of the top-level structures in the
23expression. Both
24L<PPIx::Regexp::Structure::Regexp|PPIx::Regexp::Structure::Regexp> and
25L<PPIx::Regexp::Structure::Replacement|PPIx::Regexp::Structure::Replacement>
26are derived from it.
27
28=head1 METHODS
29
30This class provides the following public methods. Methods not documented
31here are private, and unsupported in the sense that the author reserves
32the right to change or remove them without notice.
33
34=cut
35
36package PPIx::Regexp::Structure::Main;
37
38218µs234µs
# spent 23µs (12+11) within PPIx::Regexp::Structure::Main::BEGIN@38 which was called: # once (12µs+11µs) by PPIx::Regexp::Lexer::BEGIN@51 at line 38
use strict;
# spent 23µs making 1 call to PPIx::Regexp::Structure::Main::BEGIN@38 # spent 11µs making 1 call to strict::import
39224µs215µs
# spent 11µs (7+4) within PPIx::Regexp::Structure::Main::BEGIN@39 which was called: # once (7µs+4µs) by PPIx::Regexp::Lexer::BEGIN@51 at line 39
use warnings;
# spent 11µs making 1 call to PPIx::Regexp::Structure::Main::BEGIN@39 # spent 4µs making 1 call to warnings::import
40
412131µs2108µs
# spent 57µs (7+50) within PPIx::Regexp::Structure::Main::BEGIN@41 which was called: # once (7µs+50µs) by PPIx::Regexp::Lexer::BEGIN@51 at line 41
use base qw{ PPIx::Regexp::Structure };
# spent 57µs making 1 call to PPIx::Regexp::Structure::Main::BEGIN@41 # spent 50µs making 1 call to base::import
42
431500nsour $VERSION = '0.036';
44
45=head2 delimiters
46
47This method returns a string representing the delimiters of a regular
48expression or substitution string. In the case of something like
49C<s/foo/bar/>, it will return '//' for both the regular expression and
50the replacement.
51
52=cut
53
54sub delimiters {
55 my ( $self ) = @_;
56 my @delims;
57 foreach my $method ( qw{ start finish } ) {
58 push @delims, undef;
59 defined ( my $obj = $self->$method() )
60 or next;
61 defined ( my $str = $obj->content() )
62 or next;
63 $delims[-1] = $str;
64 }
65 defined ( $delims[0] )
66 or $delims[0] = $delims[1];
67 return $delims[0] . $delims[1];
68}
69
70=head2 interpolates
71
72This method returns true if the regular expression or replacement
73interpolates, and false otherwise. All it really does is to check
74whether the ending delimiter is a single quote.
75
76=cut
77
78sub interpolates {
79 my ( $self ) = @_;
80 my $finish = $self->finish( 0 ) or return 1;
81 return q<'> ne $finish->content();
82}
83
8412µs1;
85
86__END__