← 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:11 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm
StatementsExecuted 23 statements in 435µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11126µs26µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@10Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@10
1118µs37µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@16Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@16
1118µs30µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@13Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@13
1118µs376µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@15Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@15
1118µs58µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@20Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@20
1117µs11µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@12Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@12
1117µs196µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@18Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@18
1117µs18µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::BEGIN@11Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@11
1116µs7µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::default_severityPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::default_severity
1115µs5µsPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::supported_parametersPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::supported_parameters
0000s0sPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::applies_toPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::applies_to
0000s0sPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::default_themesPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::default_themes
0000s0sPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::initialize_if_enabledPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::initialize_if_enabled
0000s0sPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::::violatesPerl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::violates
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1##############################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##############################################################################
7
8package Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters;
9
10250µs126µs
# spent 26µs within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@10 which was called: # once (26µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11221µs230µs
# spent 18µs (7+11) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@11 # spent 11µs making 1 call to strict::import
12223µs215µs
# spent 11µs (7+4) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@12 which was called: # once (7µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@12 # spent 4µs making 1 call to warnings::import
13223µs251µs
# spent 30µs (8+22) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@13 which was called: # once (8µs+22µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 30µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@13 # spent 22µs making 1 call to Exporter::import
14
15223µs2744µs
# spent 376µs (8+368) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@15 which was called: # once (8µs+368µs) by Module::Pluggable::Object::_require at line 15
use English qw(-no_match_vars);
# spent 376µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@15 # spent 368µs making 1 call to English::import
16223µs265µs
# spent 37µs (8+28) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@16 which was called: # once (8µs+28µs) by Module::Pluggable::Object::_require at line 16
use Carp;
# spent 37µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@16 # spent 28µs making 1 call to Exporter::import
17
18224µs2386µs
# spent 196µs (7+189) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@18 which was called: # once (7µs+189µs) by Module::Pluggable::Object::_require at line 18
use Perl::Critic::Utils qw{ :booleans :severities hashify };
# spent 196µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@18 # spent 189µs making 1 call to Exporter::import
19
202230µs2110µs
# spent 58µs (8+51) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@20 which was called: # once (8µs+51µs) by Module::Pluggable::Object::_require at line 20
use base 'Perl::Critic::Policy';
# spent 58µs making 1 call to Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@20 # spent 51µs making 1 call to base::import
21
221500nsour $VERSION = '1.121';
23
24#-----------------------------------------------------------------------------
25
2612µs128µsReadonly::Scalar my $DESC => q<Use only '//' or '{}' to delimit regexps>;
# spent 28µs making 1 call to Readonly::Scalar
2712µs142µsReadonly::Scalar my $EXPL => [246];
# spent 42µs making 1 call to Readonly::Scalar
28
2911µs120µsReadonly::Array my @EXTRA_BRACKETS => qw{ () [] <> };
# spent 20µs making 1 call to Readonly::Array
30
31#-----------------------------------------------------------------------------
32
33
# spent 5µs within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::supported_parameters which was called: # once (5µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
34 return (
35 {
3618µs name => 'allow_all_brackets',
37 description =>
38 q[In addition to allowing '{}', allow '()', '[]', and '{}'.],
39 behavior => 'boolean',
40 },
41 );
42}
43
4411µs
# spent 7µs (6+1) within Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::default_severity which was called: # once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_LOWEST }
45sub default_themes { return qw( core pbp cosmetic ) }
46sub applies_to { return qw(PPI::Token::Regexp::Match
47 PPI::Token::Regexp::Substitute
48 PPI::Token::QuoteLike::Regexp) }
49
50#-----------------------------------------------------------------------------
51
52sub initialize_if_enabled {
53 my ( $self, $config ) = @_;
54
55 my %delimiters = hashify( qw< // {} > );
56 if ( $self->{_allow_all_brackets} ) {
57 @delimiters{ @EXTRA_BRACKETS } = (1) x @EXTRA_BRACKETS;
58 }
59
60 $self->{_allowed_delimiters} = \%delimiters;
61
62 return $TRUE;
63}
64
65#-----------------------------------------------------------------------------
66
67sub violates {
68 my ( $self, $elem, undef ) = @_;
69
70 my $allowed_delimiters = $self->{_allowed_delimiters};
71 foreach my $delimiter ($elem->get_delimiters()) {
72 next if $allowed_delimiters->{$delimiter};
73 return $self->violation( $DESC, $EXPL, $elem );
74 }
75
76 return; # OK
77}
78
7914µs1;
80
81__END__