Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/InputOutput/ProhibitTwoArgOpen.pm |
Statements | Executed 27160 statements in 53.2ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
13481 | 1 | 1 | 45.7ms | 413ms | violates | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
144 | 1 | 1 | 258µs | 258µs | applies_to | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 18µs | 18µs | BEGIN@10 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 12µs | 25µs | BEGIN@11 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 10µs | 28µs | BEGIN@16 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 9µs | 38µs | BEGIN@14 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 8µs | 13µs | BEGIN@12 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 8µs | 487µs | BEGIN@18 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 8µs | 66µs | BEGIN@19 | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 8µs | 9µs | default_severity | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
2 | 2 | 1 | 3µs | 3µs | CORE:qr (opcode) | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
1 | 1 | 1 | 2µs | 2µs | supported_parameters | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ############################################################################## | ||||
2 | # $URL$ | ||||
3 | # $Date$ | ||||
4 | # $Author$ | ||||
5 | # $Revision$ | ||||
6 | ############################################################################## | ||||
7 | |||||
8 | package Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen; | ||||
9 | |||||
10 | 2 | 44µs | 1 | 18µs | # spent 18µs within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@10 which was called:
# once (18µs+0s) by Module::Pluggable::Object::_require at line 10 # spent 18µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@10 |
11 | 2 | 24µs | 2 | 38µs | # spent 25µs (12+13) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@11 which was called:
# once (12µs+13µs) by Module::Pluggable::Object::_require at line 11 # spent 25µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@11
# spent 13µs making 1 call to strict::import |
12 | 2 | 21µs | 2 | 17µs | # spent 13µs (8+4) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@12 which was called:
# once (8µs+4µs) by Module::Pluggable::Object::_require at line 12 # spent 13µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 23µs | 2 | 68µs | # spent 38µs (9+30) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@14 which was called:
# once (9µs+30µs) by Module::Pluggable::Object::_require at line 14 # spent 38µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@14
# spent 30µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 31µs | 2 | 47µs | # spent 28µs (10+19) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@16 which was called:
# once (10µs+19µs) by Module::Pluggable::Object::_require at line 16 # spent 28µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@16
# spent 18µs making 1 call to version::import |
17 | |||||
18 | 2 | 27µs | 2 | 966µs | # spent 487µs (8+479) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@18 which was called:
# once (8µs+479µs) by Module::Pluggable::Object::_require at line 18 # spent 487µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@18
# spent 479µs making 1 call to Exporter::import |
19 | 2 | 305µs | 2 | 123µs | # spent 66µs (8+57) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@19 which was called:
# once (8µs+57µs) by Module::Pluggable::Object::_require at line 19 # spent 66µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::BEGIN@19
# spent 57µs making 1 call to base::import |
20 | |||||
21 | 1 | 700ns | our $VERSION = '1.121'; | ||
22 | |||||
23 | #----------------------------------------------------------------------------- | ||||
24 | |||||
25 | 1 | 11µs | 2 | 34µs | Readonly::Scalar my $STDIO_HANDLES_RX => qr/\b STD (?: IN | OUT | ERR \b)/xms; # spent 32µs making 1 call to Readonly::Scalar
# spent 2µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::CORE:qr |
26 | 1 | 5µs | 2 | 25µs | Readonly::Scalar my $FORK_HANDLES_RX => qr/\A (?: -[|] | [|]- ) \z/xms; # spent 24µs making 1 call to Readonly::Scalar
# spent 1µs making 1 call to Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::CORE:qr |
27 | 1 | 1µs | 1 | 23µs | Readonly::Scalar my $DESC => q{Two-argument "open" used}; # spent 23µs making 1 call to Readonly::Scalar |
28 | 1 | 2µs | 1 | 48µs | Readonly::Scalar my $EXPL => [ 207 ]; # spent 48µs making 1 call to Readonly::Scalar |
29 | |||||
30 | 1 | 11µs | 2 | 30µs | Readonly::Scalar my $MINIMUM_VERSION => version->new(5.006); # spent 24µs making 1 call to Readonly::Scalar
# spent 6µs making 1 call to version::new |
31 | |||||
32 | #----------------------------------------------------------------------------- | ||||
33 | |||||
34 | 1 | 6µs | # spent 2µs within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::supported_parameters which was called:
# once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
35 | 1 | 2µs | # spent 9µs (8+2) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::default_severity which was called:
# once (8µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
36 | sub default_themes { return qw(core pbp bugs security certrule) } | ||||
37 | 144 | 370µs | # spent 258µs within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::applies_to which was called 144 times, avg 2µs/call:
# 144 times (258µs+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2µs/call | ||
38 | |||||
39 | #----------------------------------------------------------------------------- | ||||
40 | |||||
41 | # spent 413ms (45.7+368) within Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::violates which was called 13481 times, avg 31µs/call:
# 13481 times (45.7ms+368ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 31µs/call | ||||
42 | 13481 | 3.09ms | my ($self, $elem, $document) = @_; | ||
43 | |||||
44 | 13481 | 49.1ms | 13481 | 289ms | return if $elem ne 'open'; # spent 289ms making 13481 calls to PPI::Element::__ne, avg 21µs/call |
45 | 6 | 12µs | 6 | 1.98ms | return if ! is_function_call($elem); # spent 1.98ms making 6 calls to Perl::Critic::Utils::is_function_call, avg 330µs/call |
46 | |||||
47 | 5 | 19µs | 5 | 74.5ms | my $version = $document->highest_explicit_perl_version(); # spent 74.5ms making 5 calls to Perl::Critic::Document::highest_explicit_perl_version, avg 14.9ms/call |
48 | 5 | 83µs | 25 | 76µs | return if $version and $version < $MINIMUM_VERSION; # spent 46µs making 5 calls to version::(<=>, avg 9µs/call
# spent 18µs making 15 calls to Readonly::Scalar::FETCH, avg 1µs/call
# spent 13µs making 5 calls to version::(bool, avg 3µs/call |
49 | |||||
50 | 5 | 11µs | 5 | 2.31ms | my @args = parse_arg_list($elem); # spent 2.31ms making 5 calls to Perl::Critic::Utils::parse_arg_list, avg 461µs/call |
51 | |||||
52 | 5 | 2µs | if ( scalar @args == 2 ) { | ||
53 | # When opening STDIN, STDOUT, or STDERR, the | ||||
54 | # two-arg form is the only option you have. | ||||
55 | return if $args[1]->[0] =~ $STDIO_HANDLES_RX; | ||||
56 | return if $args[1]->[0]->isa( 'PPI::Token::Quote' ) | ||||
57 | && $args[1]->[0]->string() =~ $FORK_HANDLES_RX; | ||||
58 | return $self->violation( $DESC, $EXPL, $elem ); | ||||
59 | } | ||||
60 | |||||
61 | 5 | 14µs | return; # ok! | ||
62 | } | ||||
63 | |||||
64 | 1 | 5µs | 1; | ||
65 | |||||
66 | __END__ | ||||
sub Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen::CORE:qr; # opcode |