Filename | /var/www/foswikidev/core/lib/Foswiki/Prefs/Web.pm |
Statements | Executed 412 statements in 1.02ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
111 | 1 | 1 | 555µs | 3.13ms | get | Foswiki::Prefs::Web::
17 | 1 | 1 | 100µs | 226µs | finish | Foswiki::Prefs::Web::
17 | 1 | 1 | 82µs | 82µs | new | Foswiki::Prefs::Web::
8 | 1 | 1 | 37µs | 51µs | isInTopOfStack | Foswiki::Prefs::Web::
7 | 1 | 1 | 26µs | 542µs | cloneStack | Foswiki::Prefs::Web::
1 | 1 | 1 | 13µs | 26µs | BEGIN@18 | Foswiki::Prefs::Web::
1 | 1 | 1 | 11µs | 15µs | BEGIN@19 | Foswiki::Prefs::Web::
1 | 1 | 1 | 4µs | 4µs | BEGIN@21 | Foswiki::Prefs::Web::
1 | 1 | 1 | 2µs | 2µs | stack | Foswiki::Prefs::Web::
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 | ---+ UNPUBLISHED package Foswiki::Prefs::Web | ||||
6 | |||||
7 | This class is a simple wrapper around Foswiki::Prefs::Stack. Since Webs has an | ||||
8 | hierarchical structure it's needed only one stack to deal with preferences from | ||||
9 | Web and Web/Subweb and Web/Subweb/Subsubweb. This class has a reference to a | ||||
10 | stack and the level where the web is. | ||||
11 | |||||
12 | This class is used by Foswiki::Prefs to pass web preferences to Foswiki::Meta | ||||
13 | and should not be used for anything else. | ||||
14 | |||||
15 | =cut | ||||
16 | |||||
17 | package Foswiki::Prefs::Web; | ||||
18 | 2 | 26µs | 2 | 40µs | # spent 26µs (13+14) within Foswiki::Prefs::Web::BEGIN@18 which was called:
# once (13µs+14µs) by Foswiki::Prefs::BEGIN@78 at line 18 # spent 26µs making 1 call to Foswiki::Prefs::Web::BEGIN@18
# spent 14µs making 1 call to strict::import |
19 | 2 | 49µs | 2 | 19µs | # spent 15µs (11+4) within Foswiki::Prefs::Web::BEGIN@19 which was called:
# once (11µs+4µs) by Foswiki::Prefs::BEGIN@78 at line 19 # spent 15µs making 1 call to Foswiki::Prefs::Web::BEGIN@19
# spent 4µs making 1 call to warnings::import |
20 | |||||
21 | # spent 4µs within Foswiki::Prefs::Web::BEGIN@21 which was called:
# once (4µs+0s) by Foswiki::Prefs::BEGIN@78 at line 26 | ||||
22 | 1 | 5µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
23 | require locale; | ||||
24 | import locale(); | ||||
25 | } | ||||
26 | 1 | 219µs | 1 | 4µs | } # spent 4µs making 1 call to Foswiki::Prefs::Web::BEGIN@21 |
27 | |||||
28 | =begin TML | ||||
29 | |||||
30 | ---++ ClassMethod new( $session ) | ||||
31 | |||||
32 | Creates a new WebPrefs object. | ||||
33 | |||||
34 | =cut | ||||
35 | |||||
36 | # spent 82µs within Foswiki::Prefs::Web::new which was called 17 times, avg 5µs/call:
# 17 times (82µs+0s) by Foswiki::Prefs::_getWebPrefsObj at line 210 of /var/www/foswikidev/core/lib/Foswiki/Prefs.pm, avg 5µs/call | ||||
37 | 17 | 6µs | my $proto = shift; | ||
38 | 17 | 6µs | my $class = ref($proto) || $proto; | ||
39 | 17 | 9µs | my ( $stack, $level ) = @_; | ||
40 | 17 | 21µs | my $this = { | ||
41 | stack => $stack, | ||||
42 | level => $level, | ||||
43 | }; | ||||
44 | 17 | 56µs | return bless $this, $class; | ||
45 | } | ||||
46 | |||||
47 | =begin TML | ||||
48 | |||||
49 | ---++ ObjectMethod finish() | ||||
50 | |||||
51 | Break circular references. | ||||
52 | |||||
53 | =cut | ||||
54 | |||||
55 | # Note to developers; please undef *all* fields in the object explicitly, | ||||
56 | # whether they are references or not. That way this method is "golden | ||||
57 | # documentation" of the live fields in the object. | ||||
58 | # spent 226µs (100+126) within Foswiki::Prefs::Web::finish which was called 17 times, avg 13µs/call:
# 17 times (100µs+126µs) by Foswiki::Prefs::finish at line 135 of /var/www/foswikidev/core/lib/Foswiki/Prefs.pm, avg 13µs/call | ||||
59 | 17 | 4µs | my $this = shift; | ||
60 | 17 | 55µs | 17 | 126µs | $this->{stack}->finish() if $this->{stack}; # spent 126µs making 17 calls to Foswiki::Prefs::Stack::finish, avg 7µs/call |
61 | 17 | 8µs | undef $this->{stack}; | ||
62 | 17 | 28µs | undef $this->{level}; | ||
63 | } | ||||
64 | |||||
65 | =begin TML | ||||
66 | |||||
67 | ---++ ObjectMethod isInTopOfStack() -> $boolean | ||||
68 | |||||
69 | Returns true if this web is the hihger of the underlying stack object. | ||||
70 | |||||
71 | =cut | ||||
72 | |||||
73 | # spent 51µs (37+14) within Foswiki::Prefs::Web::isInTopOfStack which was called 8 times, avg 6µs/call:
# 8 times (37µs+14µs) by Foswiki::Prefs::_getWebPrefsObj at line 195 of /var/www/foswikidev/core/lib/Foswiki/Prefs.pm, avg 6µs/call | ||||
74 | 8 | 2µs | my $this = shift; | ||
75 | 8 | 29µs | 8 | 14µs | return $this->{level} == $this->{stack}->size() - 1; # spent 14µs making 8 calls to Foswiki::Prefs::Stack::size, avg 2µs/call |
76 | } | ||||
77 | |||||
78 | =begin TML | ||||
79 | |||||
80 | ---++ ObjectMethod stack() -> $stack | ||||
81 | |||||
82 | Read-only accessor to the underlying stack object. | ||||
83 | |||||
84 | =cut | ||||
85 | |||||
86 | # spent 2µs within Foswiki::Prefs::Web::stack which was called:
# once (2µs+0s) by Foswiki::Prefs::_getWebPrefsObj at line 195 of /var/www/foswikidev/core/lib/Foswiki/Prefs.pm | ||||
87 | 1 | 5µs | return $_[0]->{stack}; | ||
88 | } | ||||
89 | |||||
90 | =begin TML | ||||
91 | |||||
92 | ---++ ObjectMethod cloneStack($level) -> $stack | ||||
93 | |||||
94 | This method clone the underlying stack object, to the given $level. See | ||||
95 | Foswiki::Prefs::Stack::clone documentation. | ||||
96 | |||||
97 | This method exists because WebPrefs objects are used by Foswiki::Prefs instead | ||||
98 | of bar Foswiki::Prefs::Stack and this operation is needed. | ||||
99 | |||||
100 | =cut | ||||
101 | |||||
102 | # spent 542µs (26+516) within Foswiki::Prefs::Web::cloneStack which was called 7 times, avg 77µs/call:
# 7 times (26µs+516µs) by Foswiki::Prefs::_getWebPrefsObj at line 195 of /var/www/foswikidev/core/lib/Foswiki/Prefs.pm, avg 77µs/call | ||||
103 | 7 | 3µs | my ( $this, $level ) = @_; | ||
104 | 7 | 22µs | 7 | 516µs | return $this->{stack}->clone($level); # spent 516µs making 7 calls to Foswiki::Prefs::Stack::clone, avg 74µs/call |
105 | } | ||||
106 | |||||
107 | =begin TML | ||||
108 | |||||
109 | ---++ ObjectMethod get($pref) -> $value | ||||
110 | |||||
111 | Returns the $value of the given $pref. | ||||
112 | |||||
113 | =cut | ||||
114 | |||||
115 | # spent 3.13ms (555µs+2.57) within Foswiki::Prefs::Web::get which was called 111 times, avg 28µs/call:
# 111 times (555µs+2.57ms) by Foswiki::Meta::getPreference at line 681 of /var/www/foswikidev/core/lib/Foswiki/Meta.pm, avg 28µs/call | ||||
116 | 111 | 68µs | my ( $this, $key ) = @_; | ||
117 | 111 | 399µs | 111 | 2.57ms | $this->{stack}->getPreference( $key, $this->{level} ); # spent 2.57ms making 111 calls to Foswiki::Prefs::Stack::getPreference, avg 23µs/call |
118 | } | ||||
119 | |||||
120 | 1 | 2µs | 1; | ||
121 | __END__ |