← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:15 2015

Filename/var/www/foswikidev/core/lib/Foswiki/If/OP_allows.pm
StatementsExecuted 31 statements in 524µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11138µs180µsFoswiki::If::OP_allows::::evaluateFoswiki::If::OP_allows::evaluate
11119µs26µsFoswiki::If::OP_allows::::newFoswiki::If::OP_allows::new
11118µs30µsFoswiki::If::OP_allows::::BEGIN@12Foswiki::If::OP_allows::BEGIN@12
1119µs13µsFoswiki::If::OP_allows::::BEGIN@13Foswiki::If::OP_allows::BEGIN@13
1119µs34µsFoswiki::If::OP_allows::::BEGIN@18Foswiki::If::OP_allows::BEGIN@18
1113µs3µsFoswiki::If::OP_allows::::BEGIN@19Foswiki::If::OP_allows::BEGIN@19
1113µs3µsFoswiki::If::OP_allows::::BEGIN@21Foswiki::If::OP_allows::BEGIN@21
1113µs3µsFoswiki::If::OP_allows::::BEGIN@15Foswiki::If::OP_allows::BEGIN@15
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2
3=begin TML
4
5---+ package Foswiki::If::OP_allows
6Test that the topic name on the LHS allows the access mode on the RHS.
7
8=cut
9
10package Foswiki::If::OP_allows;
11
12227µs242µs
# spent 30µs (18+12) within Foswiki::If::OP_allows::BEGIN@12 which was called: # once (18µs+12µs) by Foswiki::If::Parser::BEGIN@22 at line 12
use strict;
# spent 30µs making 1 call to Foswiki::If::OP_allows::BEGIN@12 # spent 12µs making 1 call to strict::import
13222µs217µs
# spent 13µs (9+4) within Foswiki::If::OP_allows::BEGIN@13 which was called: # once (9µs+4µs) by Foswiki::If::Parser::BEGIN@22 at line 13
use warnings;
# spent 13µs making 1 call to Foswiki::If::OP_allows::BEGIN@13 # spent 4µs making 1 call to warnings::import
14
15230µs13µs
# spent 3µs within Foswiki::If::OP_allows::BEGIN@15 which was called: # once (3µs+0s) by Foswiki::If::Parser::BEGIN@22 at line 15
use Foswiki::Query::OP ();
# spent 3µs making 1 call to Foswiki::If::OP_allows::BEGIN@15
1616µsour @ISA = ('Foswiki::Query::OP');
17
18227µs258µs
# spent 34µs (9+25) within Foswiki::If::OP_allows::BEGIN@18 which was called: # once (9µs+25µs) by Foswiki::If::Parser::BEGIN@22 at line 18
use Assert;
# spent 34µs making 1 call to Foswiki::If::OP_allows::BEGIN@18 # spent 25µs making 1 call to Exporter::import
19239µs13µs
# spent 3µs within Foswiki::If::OP_allows::BEGIN@19 which was called: # once (3µs+0s) by Foswiki::If::Parser::BEGIN@22 at line 19
use Foswiki::Meta ();
# spent 3µs making 1 call to Foswiki::If::OP_allows::BEGIN@19
20
21
# spent 3µs within Foswiki::If::OP_allows::BEGIN@21 which was called: # once (3µs+0s) by Foswiki::If::Parser::BEGIN@22 at line 26
BEGIN {
2214µs if ( $Foswiki::cfg{UseLocale} ) {
23 require locale;
24 import locale();
25 }
261231µs13µs}
# spent 3µs making 1 call to Foswiki::If::OP_allows::BEGIN@21
27
28
# spent 26µs (19+6) within Foswiki::If::OP_allows::new which was called: # once (19µs+6µs) by Foswiki::If::Parser::new at line 49 of /var/www/foswikidev/core/lib/Foswiki/If/Parser.pm
sub new {
291300ns my $class = shift;
301109µs16µs return $class->SUPER::new( arity => 2, name => 'allows', prec => 600 );
# spent 6µs making 1 call to Foswiki::Query::OP::new
31}
32
33
# spent 180µs (38+142) within Foswiki::If::OP_allows::evaluate which was called: # once (38µs+142µs) by Foswiki::Query::Node::evaluate at line 223 of /var/www/foswikidev/core/lib/Foswiki/Query/Node.pm
sub evaluate {
341200ns my $this = shift;
351100ns my $node = shift;
361500ns my $a = $node->{params}->[0]; # topic name (string)
371300ns my $b = $node->{params}->[1]; # access mode (string)
3811µs12µs my $mode = $b->_evaluate(@_) || 'view';
# spent 2µs making 1 call to Foswiki::If::Node::_evaluate
3911µs my %domain = @_;
4012µs11µs my $session = $domain{tom}->session;
# spent 1µs making 1 call to Foswiki::Meta::session
411300ns throw Error::Simple(
42 'No context in which to evaluate "' . $a->stringify() . '"' )
43 unless $session;
44
4511µs10s my $str = $a->evaluate(@_);
# spent 4µs making 1 call to Foswiki::Query::Node::evaluate, recursion: max depth 1, sum of overlapping time 4µs
461100ns return 0 unless $str;
47
4813µs18µs my ( $web, $topic ) =
# spent 8µs making 1 call to Foswiki::normalizeWebTopicName
49 $session->normalizeWebTopicName( $session->{webName}, $str );
50
511300ns my $ok = 0;
52
53 # Try for an existing topic first.
5413µs169µs if ( $session->topicExists( $web, $topic ) ) {
# spent 69µs making 1 call to Foswiki::topicExists
55
5614µs115µs my $topicObject = Foswiki::Meta->new( $session, $web, $topic );
# spent 15µs making 1 call to Foswiki::Meta::new
5714µs143µs $ok = $topicObject->haveAccess($mode);
# spent 43µs making 1 call to Foswiki::Meta::haveAccess
58 }
59
60 # Not an existing web.topic name, see if the string on its own
61 # is a web name
62 elsif ( $session->webExists($str) ) {
63 my $webObject = Foswiki::Meta->new( $session, $str );
64 $ok = $webObject->haveAccess($mode);
65 }
66
67 # Not an existing web.topic or a web on it's own; maybe it's
68 # web.topic for an existing web but non-existing topic
69 elsif ( $session->webExists($web) ) {
70 my $webObject = Foswiki::Meta->new( $session, $web );
71 $ok = $webObject->haveAccess($mode);
72 }
73 else {
74 $ok = 0;
75 }
7614µs return $ok ? 1 : 0;
77}
78
7913µs1;
80__END__