Filename | /var/www/foswiki11/lib/Foswiki/Plugins/JQueryPlugin/Plugins.pm |
Statements | Executed 392 statements in 2.30ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
56 | 2 | 2 | 468µs | 698µs | registerPlugin | Foswiki::Plugins::JQueryPlugin::Plugins::
1 | 1 | 1 | 345µs | 4.06ms | init | Foswiki::Plugins::JQueryPlugin::Plugins::
2 | 1 | 1 | 141µs | 2.51ms | load | Foswiki::Plugins::JQueryPlugin::Plugins::
1 | 1 | 1 | 128µs | 128µs | finish | Foswiki::Plugins::JQueryPlugin::Plugins::
7 | 1 | 1 | 38µs | 38µs | registerTheme | Foswiki::Plugins::JQueryPlugin::Plugins::
2 | 2 | 2 | 30µs | 2.97ms | createPlugin (recurses: max depth 1, inclusive time 577µs) | Foswiki::Plugins::JQueryPlugin::Plugins::
1 | 1 | 1 | 22µs | 65µs | createTheme | Foswiki::Plugins::JQueryPlugin::Plugins::
1 | 1 | 1 | 13µs | 25µs | BEGIN@4 | Foswiki::Plugins::JQueryPlugin::Plugins::
1 | 1 | 1 | 9µs | 14µs | BEGIN@5 | Foswiki::Plugins::JQueryPlugin::Plugins::
1 | 1 | 1 | 6µs | 6µs | BEGIN@6 | Foswiki::Plugins::JQueryPlugin::Plugins::
0 | 0 | 0 | 0s | 0s | expandVariables | Foswiki::Plugins::JQueryPlugin::Plugins::
0 | 0 | 0 | 0s | 0s | getIconUrlPath | Foswiki::Plugins::JQueryPlugin::Plugins::
0 | 0 | 0 | 0s | 0s | getPlugins | Foswiki::Plugins::JQueryPlugin::Plugins::
0 | 0 | 0 | 0s | 0s | getRandom | Foswiki::Plugins::JQueryPlugin::Plugins::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki::Plugins::JQueryPlugin::Plugins; | ||||
3 | |||||
4 | 2 | 26µs | 2 | 37µs | # spent 25µs (13+12) within Foswiki::Plugins::JQueryPlugin::Plugins::BEGIN@4 which was called:
# once (13µs+12µs) by Foswiki::Plugins::JQueryPlugin::BEGIN@15 at line 4 # spent 25µs making 1 call to Foswiki::Plugins::JQueryPlugin::Plugins::BEGIN@4
# spent 12µs making 1 call to strict::import |
5 | 2 | 26µs | 2 | 19µs | # spent 14µs (9+5) within Foswiki::Plugins::JQueryPlugin::Plugins::BEGIN@5 which was called:
# once (9µs+5µs) by Foswiki::Plugins::JQueryPlugin::BEGIN@15 at line 5 # spent 14µs making 1 call to Foswiki::Plugins::JQueryPlugin::Plugins::BEGIN@5
# spent 5µs making 1 call to warnings::import |
6 | 2 | 1.15ms | 1 | 6µs | # spent 6µs within Foswiki::Plugins::JQueryPlugin::Plugins::BEGIN@6 which was called:
# once (6µs+0s) by Foswiki::Plugins::JQueryPlugin::BEGIN@15 at line 6 # spent 6µs making 1 call to Foswiki::Plugins::JQueryPlugin::Plugins::BEGIN@6 |
7 | |||||
8 | 1 | 200ns | my @iconSearchPath; | ||
9 | 1 | 100ns | my %iconCache; | ||
10 | 1 | 0s | my %plugins; | ||
11 | 1 | 100ns | my %themes; | ||
12 | 1 | 100ns | my $debug; | ||
13 | 1 | 0s | my $currentTheme; | ||
14 | |||||
15 | =begin TML | ||||
16 | |||||
17 | ---+ package Foswiki::Plugins::JQueryPlugin | ||||
18 | |||||
19 | Container for jQuery and plugins | ||||
20 | |||||
21 | =cut | ||||
22 | |||||
23 | =begin TML | ||||
24 | |||||
25 | ---++ init() | ||||
26 | |||||
27 | initialize plugin container | ||||
28 | |||||
29 | =cut | ||||
30 | |||||
31 | # spent 4.06ms (345µs+3.71) within Foswiki::Plugins::JQueryPlugin::Plugins::init which was called:
# once (345µs+3.71ms) by Foswiki::Plugins::JQueryPlugin::initPlugin at line 57 of /var/www/foswiki11/lib/Foswiki/Plugins/JQueryPlugin.pm | ||||
32 | |||||
33 | 1 | 2µs | $debug = $Foswiki::cfg{JQueryPlugin}{Debug} || 0; | ||
34 | |||||
35 | # get all plugins | ||||
36 | 1 | 48µs | foreach | ||
37 | my $pluginName ( sort keys %{ $Foswiki::cfg{JQueryPlugin}{Plugins} } ) | ||||
38 | { | ||||
39 | 60 | 145µs | 55 | 686µs | registerPlugin($pluginName) # spent 686µs making 55 calls to Foswiki::Plugins::JQueryPlugin::Plugins::registerPlugin, avg 12µs/call |
40 | if $Foswiki::cfg{JQueryPlugin}{Plugins}{$pluginName}{Enabled}; | ||||
41 | } | ||||
42 | |||||
43 | # get all themes | ||||
44 | 1 | 10µs | foreach my $themeName ( sort keys %{ $Foswiki::cfg{JQueryPlugin}{Themes} } ) | ||
45 | { | ||||
46 | 7 | 20µs | 7 | 38µs | registerTheme($themeName) # spent 38µs making 7 calls to Foswiki::Plugins::JQueryPlugin::Plugins::registerTheme, avg 5µs/call |
47 | if $Foswiki::cfg{JQueryPlugin}{Themes}{$themeName}{Enabled}; | ||||
48 | } | ||||
49 | 1 | 2µs | $currentTheme = $Foswiki::cfg{JQueryPlugin}{JQueryTheme}; | ||
50 | |||||
51 | # load jquery | ||||
52 | 1 | 900ns | my $jQuery = $Foswiki::cfg{JQueryPlugin}{JQueryVersion} || "jquery-1.8.3"; | ||
53 | 1 | 200ns | $jQuery .= ".uncompressed" if $debug; | ||
54 | 1 | 1µs | my $jQueryIE = $Foswiki::cfg{JQueryPlugin}{JQueryVersionForOldIEs} || ""; | ||
55 | 1 | 200ns | $jQueryIE .= ".uncompressed" if $debug; | ||
56 | |||||
57 | 1 | 200ns | my $code; | ||
58 | |||||
59 | 1 | 700ns | if ($jQueryIE) { | ||
60 | $code = <<"HERE"; | ||||
61 | <literal><!--[if lte IE 9]> | ||||
62 | <script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/$jQueryIE.js'></script> | ||||
63 | <![endif]--> | ||||
64 | <!--[if gt IE 9]><!--> | ||||
65 | <script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/$jQuery.js'></script> | ||||
66 | <!--<![endif]--> | ||||
67 | </literal> | ||||
68 | HERE | ||||
69 | } | ||||
70 | else { | ||||
71 | 1 | 2µs | $code = <<"HERE"; | ||
72 | <script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/$jQuery.js'></script> | ||||
73 | HERE | ||||
74 | } | ||||
75 | |||||
76 | # switch on noconflict mode | ||||
77 | 1 | 800ns | $code .= | ||
78 | "<script type='text/javascript'>var \$j = jQuery.noConflict();</script>" | ||||
79 | if $Foswiki::cfg{JQueryPlugin}{NoConflict}; | ||||
80 | |||||
81 | 1 | 1µs | 1 | 22µs | Foswiki::Func::addToZone( 'script', 'JQUERYPLUGIN', $code ); # spent 22µs making 1 call to Foswiki::Func::addToZone |
82 | |||||
83 | # initial plugins | ||||
84 | 1 | 3µs | 1 | 2.97ms | createPlugin('Foswiki'); # this one is needed anyway # spent 2.97ms making 1 call to Foswiki::Plugins::JQueryPlugin::Plugins::createPlugin |
85 | |||||
86 | 1 | 1µs | my $defaultPlugins = $Foswiki::cfg{JQueryPlugin}{DefaultPlugins}; | ||
87 | 1 | 400ns | if ($defaultPlugins) { | ||
88 | foreach my $pluginName ( split( /\s*,\s*/, $defaultPlugins ) ) { | ||||
89 | createPlugin($pluginName); | ||||
90 | } | ||||
91 | } | ||||
92 | |||||
93 | # enable migrate for jQuery > 1.9.x as long as we still have 3rd party plugins | ||||
94 | # making use of deprecated and removed features | ||||
95 | 1 | 12µs | unless ( $defaultPlugins =~ /\bmigrate\b/i ) { | ||
96 | 1 | 5µs | if ( $jQuery =~ /^jquery-(\d+)\.(\d+)\.(\d+)/ ) { | ||
97 | 1 | 6µs | my $jqVersion = $1 * 10000 + $2 * 100 + $3; | ||
98 | 1 | 1µs | if ( $jqVersion > 10900 ) { | ||
99 | createPlugin("Migrate"); | ||||
100 | } | ||||
101 | } | ||||
102 | } | ||||
103 | } | ||||
104 | |||||
105 | =begin TML | ||||
106 | |||||
107 | ---++ ObjectMethod createPlugin( $pluginName, ... ) -> $plugin | ||||
108 | |||||
109 | Helper method to establish plugin dependencies. See =load()=. | ||||
110 | |||||
111 | =cut | ||||
112 | |||||
113 | # spent 2.97ms (30µs+2.94) within Foswiki::Plugins::JQueryPlugin::Plugins::createPlugin which was called 2 times, avg 1.48ms/call:
# once (14µs+2.95ms) by Foswiki::Plugins::JQueryPlugin::Plugins::init at line 84
# once (16µs+-16µs) by Foswiki::Plugins::JQueryPlugin::Plugin::init at line 119 of /var/www/foswiki11/lib/Foswiki/Plugins/JQueryPlugin/Plugin.pm | ||||
114 | 2 | 5µs | 2 | 2.51ms | my $plugin = load(@_); # spent 2.51ms making 2 calls to Foswiki::Plugins::JQueryPlugin::Plugins::load, avg 1.26ms/call |
115 | 2 | 11µs | 2 | 916µs | $plugin->init() if $plugin; # spent 916µs making 1 call to Foswiki::Plugins::JQueryPlugin::FOSWIKI::init
# spent 86µs making 1 call to Foswiki::Plugins::JQueryPlugin::Plugin::init, recursion: max depth 1, sum of overlapping time 86µs |
116 | 2 | 8µs | return $plugin; | ||
117 | } | ||||
118 | |||||
119 | =begin TML | ||||
120 | |||||
121 | ---++ ObjectMethd createTheme ($themeName, $url) -> $boolean | ||||
122 | |||||
123 | Helper method to switch on a theme. Returns true | ||||
124 | if =$themeName= has been loaded successfully. Note that a previously | ||||
125 | loaded theme will be replaced with the new one as there can only | ||||
126 | be one theme per html page. The $url parameter optionally specifies | ||||
127 | from where to load the theme. It defaults to the url registered | ||||
128 | in =configure= for the named theme. | ||||
129 | |||||
130 | =cut | ||||
131 | |||||
132 | # spent 65µs (22+44) within Foswiki::Plugins::JQueryPlugin::Plugins::createTheme which was called:
# once (22µs+44µs) by Foswiki::Plugins::JQueryPlugin::createTheme at line 101 of /var/www/foswiki11/lib/Foswiki/Plugins/JQueryPlugin.pm | ||||
133 | 1 | 1µs | my ( $themeName, $url ) = @_; | ||
134 | |||||
135 | 1 | 300ns | $themeName ||= $currentTheme; | ||
136 | 1 | 200ns | return 0 unless $themeName; | ||
137 | |||||
138 | 1 | 800ns | my $normalizedName = lc($themeName); | ||
139 | |||||
140 | 1 | 500ns | unless ($url) { | ||
141 | 1 | 2µs | my $themeDesc = $themes{$normalizedName}; | ||
142 | 1 | 300ns | return 0 unless defined $themeDesc; | ||
143 | 1 | 2µs | $url = $themeDesc->{url}; | ||
144 | } | ||||
145 | |||||
146 | # remember last choice | ||||
147 | 1 | 3µs | $currentTheme = $themeName; | ||
148 | |||||
149 | 1 | 8µs | 1 | 44µs | Foswiki::Func::addToZone( "head", "JQUERYPLUGIN::THEME", # spent 44µs making 1 call to Foswiki::Func::addToZone |
150 | <<HERE, "JQUERYPLUGIN::FOSWIKI, JQUERYPLUGIN::UI" ); | ||||
151 | <link rel="stylesheet" href="$url" type="text/css" media="all" /> | ||||
152 | HERE | ||||
153 | |||||
154 | 1 | 6µs | return 1; | ||
155 | } | ||||
156 | |||||
157 | =begin TML | ||||
158 | |||||
159 | ---++ ObjectMethod registerPlugin( $pluginName, $class ) -> $descriptor | ||||
160 | |||||
161 | Helper method to register a plugin. | ||||
162 | |||||
163 | =cut | ||||
164 | |||||
165 | # spent 698µs (468+230) within Foswiki::Plugins::JQueryPlugin::Plugins::registerPlugin which was called 56 times, avg 12µs/call:
# 55 times (460µs+225µs) by Foswiki::Plugins::JQueryPlugin::Plugins::init at line 39, avg 12µs/call
# once (8µs+5µs) by Foswiki::Plugins::JQueryPlugin::registerPlugin at line 119 of /var/www/foswiki11/lib/Foswiki/Plugins/JQueryPlugin.pm | ||||
166 | 56 | 29µs | my ( $pluginName, $class ) = @_; | ||
167 | |||||
168 | 56 | 56µs | $class ||= $Foswiki::cfg{JQueryPlugin}{Plugins}{$pluginName}{Module} | ||
169 | || 'Foswiki::Plugins::JQueryPlugin::' . uc($pluginName); | ||||
170 | |||||
171 | 56 | 122µs | 56 | 230µs | Foswiki::Func::getContext()->{ $pluginName . 'Enabled' } = 1; # spent 230µs making 56 calls to Foswiki::Func::getContext, avg 4µs/call |
172 | |||||
173 | 56 | 268µs | return $plugins{ lc($pluginName) } = { | ||
174 | 'class' => $class, | ||||
175 | 'name' => $pluginName, | ||||
176 | 'instance' => undef, | ||||
177 | }; | ||||
178 | } | ||||
179 | |||||
180 | =begin TML | ||||
181 | |||||
182 | ---++ ObjectMethod registerTheme( $themeName, $url ) -> $descriptor | ||||
183 | |||||
184 | Helper method to register a theme. | ||||
185 | |||||
186 | =cut | ||||
187 | |||||
188 | # spent 38µs within Foswiki::Plugins::JQueryPlugin::Plugins::registerTheme which was called 7 times, avg 5µs/call:
# 7 times (38µs+0s) by Foswiki::Plugins::JQueryPlugin::Plugins::init at line 46, avg 5µs/call | ||||
189 | 7 | 4µs | my ( $themeName, $url ) = @_; | ||
190 | |||||
191 | 7 | 3µs | my $normalizedName = lc($themeName); | ||
192 | |||||
193 | 7 | 8µs | $url ||= $Foswiki::cfg{JQueryPlugin}{Themes}{$themeName}{Url} | ||
194 | || '%PUBURLPATH%/%SYSTEMWEB%/JQueryPlugin/themes/' | ||||
195 | . $normalizedName | ||||
196 | . '/jquery-ui.css'; | ||||
197 | |||||
198 | 7 | 34µs | return $themes{$normalizedName} = { | ||
199 | 'url' => $url, | ||||
200 | 'name' => $themeName, | ||||
201 | }; | ||||
202 | } | ||||
203 | |||||
204 | =begin TML | ||||
205 | |||||
206 | finalizer | ||||
207 | |||||
208 | =cut | ||||
209 | |||||
210 | # spent 128µs within Foswiki::Plugins::JQueryPlugin::Plugins::finish which was called:
# once (128µs+0s) by Foswiki::Plugins::JQueryPlugin::finishPlugin at line 75 of /var/www/foswiki11/lib/Foswiki/Plugins/JQueryPlugin.pm | ||||
211 | |||||
212 | 1 | 110µs | undef %plugins; | ||
213 | 1 | 12µs | undef %themes; | ||
214 | 1 | 2µs | undef @iconSearchPath; | ||
215 | 1 | 400ns | undef %iconCache; | ||
216 | 1 | 7µs | undef $currentTheme; | ||
217 | } | ||||
218 | |||||
219 | =begin TML | ||||
220 | |||||
221 | ---++ ObjectMethod load ( $pluginName ) -> $plugin | ||||
222 | |||||
223 | Loads a plugin and runs its initializer. | ||||
224 | |||||
225 | parameters | ||||
226 | * =$pluginName=: name of plugin | ||||
227 | |||||
228 | returns | ||||
229 | * =$plugin=: returns the plugin object or false if instantiating | ||||
230 | the plugin failed | ||||
231 | |||||
232 | =cut | ||||
233 | |||||
234 | # spent 2.51ms (141µs+2.37) within Foswiki::Plugins::JQueryPlugin::Plugins::load which was called 2 times, avg 1.26ms/call:
# 2 times (141µs+2.37ms) by Foswiki::Plugins::JQueryPlugin::Plugins::createPlugin at line 114, avg 1.26ms/call | ||||
235 | 2 | 1µs | my $pluginName = shift; | ||
236 | |||||
237 | 2 | 1µs | my $normalizedName = lc($pluginName); | ||
238 | 2 | 1µs | my $pluginDesc = $plugins{$normalizedName}; | ||
239 | |||||
240 | 2 | 500ns | return undef unless $pluginDesc; | ||
241 | |||||
242 | 2 | 2µs | unless ( defined $pluginDesc->{instance} ) { | ||
243 | |||||
244 | 2 | 103µs | eval "use $pluginDesc->{class};"; # spent 126µs executing statements in string eval # includes 579µs spent executing 1 call to 1 sub defined therein. # spent 113µs executing statements in string eval # includes 283µs spent executing 1 call to 1 sub defined therein. | ||
245 | |||||
246 | 2 | 2µs | if ($@) { | ||
247 | print STDERR "ERROR: can't load jQuery plugin $pluginName: $@\n"; | ||||
248 | $pluginDesc->{instance} = 0; | ||||
249 | } | ||||
250 | else { | ||||
251 | 2 | 12µs | 2 | 117µs | $pluginDesc->{instance} = $pluginDesc->{class}->new(); # spent 62µs making 1 call to Foswiki::Plugins::JQueryPlugin::FOSWIKI::new
# spent 55µs making 1 call to Foswiki::Plugins::JQueryPlugin::LIVEQUERY::new |
252 | } | ||||
253 | } | ||||
254 | |||||
255 | 2 | 9µs | return $pluginDesc->{instance}; | ||
256 | } | ||||
257 | |||||
258 | =begin TML | ||||
259 | |||||
260 | ---++ ObjectMethod expandVariables( $format, %params) -> $string | ||||
261 | |||||
262 | Helper function to expand standard escape sequences =$percnt=, =$nop=, | ||||
263 | =$n= and =$dollar=. | ||||
264 | |||||
265 | * =$format=: format string to be expaneded | ||||
266 | * =%params=: optional hash array containing further key-value pairs to be | ||||
267 | expanded as well, that is all occurences of =$key= will | ||||
268 | be replaced by its =value= as defined in %params | ||||
269 | * =$string=: returns the resulting text | ||||
270 | |||||
271 | =cut | ||||
272 | |||||
273 | sub expandVariables { | ||||
274 | my ( $format, %params ) = @_; | ||||
275 | |||||
276 | return '' unless $format; | ||||
277 | |||||
278 | foreach my $key ( keys %params ) { | ||||
279 | my $val = $params{$key}; | ||||
280 | $val = '' unless defined $val; | ||||
281 | $format =~ s/\$$key\b/$val/g; | ||||
282 | } | ||||
283 | $format = Foswiki::Func::decodeFormatTokens($format); | ||||
284 | |||||
285 | return $format; | ||||
286 | } | ||||
287 | |||||
288 | =begin TML | ||||
289 | |||||
290 | ---++ ObjectMethod getIconUrlPath ( $iconName ) -> $pubUrlPath | ||||
291 | |||||
292 | Returns the path to the named icon searching along a given icon search path. | ||||
293 | This path can be in =$Foswiki::cfg{JQueryPlugin}{IconSearchPath}= or will fall | ||||
294 | back to =FamFamFamSilkIcons=, =FamFamFamSilkCompanion1Icons=, | ||||
295 | =FamFamFamFlagIcons=, =FamFamFamMiniIcons=, =FamFamFamMintIcons= As you see | ||||
296 | installing Foswiki:Extensions/FamFamFamContrib would be nice to have. | ||||
297 | |||||
298 | = =$iconName=: name of icon; you will have to know the icon name by heart as listed in your | ||||
299 | favorite icon set, meaning there's no mapping between something like "semantic" and "physical" icons | ||||
300 | = =$pubUrlPath=: the path to the icon as it is attached somewhere in your wiki or the empty | ||||
301 | string if the icon was not found | ||||
302 | |||||
303 | =cut | ||||
304 | |||||
305 | sub getIconUrlPath { | ||||
306 | my ($iconName) = @_; | ||||
307 | |||||
308 | return '' unless $iconName; | ||||
309 | |||||
310 | unless (@iconSearchPath) { | ||||
311 | my $iconSearchPath = $Foswiki::cfg{JQueryPlugin}{IconSearchPath} | ||||
312 | || 'FamFamFamSilkIcons, FamFamFamSilkCompanion1Icons, FamFamFamSilkCompanion2Icons, FamFamFamSilkGeoSilkIcons, FamFamFamFlagIcons, FamFamFamMiniIcons, FamFamFamMintIcons'; | ||||
313 | @iconSearchPath = split( /\s*,\s*/, $iconSearchPath ); | ||||
314 | } | ||||
315 | |||||
316 | $iconName =~ s/^.*\.(.*?)$/$1/; # strip file extension | ||||
317 | |||||
318 | my $iconPath = $iconCache{$iconName}; | ||||
319 | |||||
320 | unless ($iconPath) { | ||||
321 | my $iconWeb = $Foswiki::cfg{SystemWebName}; | ||||
322 | my $pubSystemDir = | ||||
323 | $Foswiki::cfg{PubDir} . '/' . $Foswiki::cfg{SystemWebName}; | ||||
324 | |||||
325 | foreach my $item (@iconSearchPath) { | ||||
326 | my ( $web, $topic ) = Foswiki::Func::normalizeWebTopicName( | ||||
327 | $Foswiki::cfg{SystemWebName}, $item ); | ||||
328 | |||||
329 | # SMELL: store violation assumes the we have got file-level access | ||||
330 | # better use store api | ||||
331 | my $iconDir = | ||||
332 | $Foswiki::cfg{PubDir} . '/' | ||||
333 | . $web . '/' | ||||
334 | . $topic . '/' | ||||
335 | . $iconName . '.png'; | ||||
336 | if ( -f $iconDir ) { | ||||
337 | $iconPath = | ||||
338 | Foswiki::Func::getPubUrlPath() . '/' | ||||
339 | . $web . '/' | ||||
340 | . $topic . '/' | ||||
341 | . $iconName . '.png'; | ||||
342 | last; # first come first serve | ||||
343 | } | ||||
344 | } | ||||
345 | |||||
346 | $iconPath ||= ''; | ||||
347 | $iconCache{$iconName} = $iconPath; | ||||
348 | } | ||||
349 | |||||
350 | return $iconPath; | ||||
351 | } | ||||
352 | |||||
353 | =begin TML | ||||
354 | |||||
355 | ---++ ClassMethod getPlugins () -> @plugins | ||||
356 | |||||
357 | returns a list of all known plugins | ||||
358 | |||||
359 | =cut | ||||
360 | |||||
361 | sub getPlugins { | ||||
362 | my ($include) = @_; | ||||
363 | |||||
364 | my @plugins = (); | ||||
365 | foreach my $key ( sort keys %plugins ) { | ||||
366 | next if $key eq 'empty'; # skip this one | ||||
367 | next if $include && $key !~ /^($include)$/; | ||||
368 | my $pluginDesc = $plugins{$key}; | ||||
369 | my $plugin = load( $pluginDesc->{name} ); | ||||
370 | push @plugins, $plugin if $plugin; | ||||
371 | } | ||||
372 | |||||
373 | return @plugins; | ||||
374 | } | ||||
375 | |||||
376 | =begin TML | ||||
377 | |||||
378 | ---++ ClassMethod getRandom () -> $integer | ||||
379 | |||||
380 | returns a random positive integer between 1 and 10000. | ||||
381 | this can be used to | ||||
382 | generate html element IDs which are not | ||||
383 | allowed to clash within the same html page, | ||||
384 | even not when it got extended via ajax. | ||||
385 | |||||
386 | =cut | ||||
387 | |||||
388 | sub getRandom { | ||||
389 | return int( rand(10000) ) + 1; | ||||
390 | } | ||||
391 | |||||
392 | 1 | 3µs | 1; | ||
393 | __END__ |