← 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/I18N/Fallback.pm
StatementsExecuted 369 statements in 801µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
5922277µs277µsFoswiki::I18N::Fallback::::maketextFoswiki::I18N::Fallback::maketext
11131µs37µsFoswiki::I18N::Fallback::::finishFoswiki::I18N::Fallback::finish
11115µs29µsFoswiki::I18N::Fallback::::BEGIN@7Foswiki::I18N::Fallback::BEGIN@7
11110µs15µsFoswiki::I18N::Fallback::::BEGIN@8Foswiki::I18N::Fallback::BEGIN@8
1118µs8µsFoswiki::I18N::Fallback::::newFoswiki::I18N::Fallback::new
1115µs5µsFoswiki::I18N::Fallback::::BEGIN@13Foswiki::I18N::Fallback::BEGIN@13
1114µs4µsFoswiki::I18N::Fallback::::BEGIN@10Foswiki::I18N::Fallback::BEGIN@10
1112µs2µsFoswiki::I18N::Fallback::::languageFoswiki::I18N::Fallback::language
0000s0sFoswiki::I18N::Fallback::::_handlePluralsFoswiki::I18N::Fallback::_handlePlurals
0000s0sFoswiki::I18N::Fallback::::enabled_languagesFoswiki::I18N::Fallback::enabled_languages
0000s0sFoswiki::I18N::Fallback::::fromSiteCharSetFoswiki::I18N::Fallback::fromSiteCharSet
0000s0sFoswiki::I18N::Fallback::::toSiteCharSetFoswiki::I18N::Fallback::toSiteCharSet
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# Foswiki::I18N::Fallback - a fallback class for when
3# Locale::Maketext isn't available.
4
5package Foswiki::I18N::Fallback;
6
7228µs242µs
# spent 29µs (15+14) within Foswiki::I18N::Fallback::BEGIN@7 which was called: # once (15µs+14µs) by Foswiki::I18N::new at line 7
use strict;
# spent 29µs making 1 call to Foswiki::I18N::Fallback::BEGIN@7 # spent 14µs making 1 call to strict::import
8225µs219µs
# spent 15µs (10+4) within Foswiki::I18N::Fallback::BEGIN@8 which was called: # once (10µs+4µs) by Foswiki::I18N::new at line 8
use warnings;
# spent 15µs making 1 call to Foswiki::I18N::Fallback::BEGIN@8 # spent 4µs making 1 call to warnings::import
9
10259µs14µs
# spent 4µs within Foswiki::I18N::Fallback::BEGIN@10 which was called: # once (4µs+0s) by Foswiki::I18N::new at line 10
use Foswiki::I18N ();
# spent 4µs making 1 call to Foswiki::I18N::Fallback::BEGIN@10
1118µsour @ISA = ('Foswiki::I18N');
12
13
# spent 5µs within Foswiki::I18N::Fallback::BEGIN@13 which was called: # once (5µs+0s) by Foswiki::I18N::new at line 18
BEGIN {
1415µs if ( $Foswiki::cfg{UseLocale} ) {
15 require locale;
16 import locale();
17 }
181285µs15µs}
# spent 5µs making 1 call to Foswiki::I18N::Fallback::BEGIN@13
19
20
# spent 8µs within Foswiki::I18N::Fallback::new which was called: # once (8µs+0s) by Foswiki::I18N::new at line 195 of /var/www/foswikidev/core/lib/Foswiki/I18N.pm
sub new {
211600ns my $class = shift;
2216µs my $this = bless( {}, $class );
2316µs return $this;
24}
25
26
# spent 37µs (31+6) within Foswiki::I18N::Fallback::finish which was called: # once (31µs+6µs) by Foswiki::finish at line 2488 of /var/www/foswikidev/core/lib/Foswiki.pm
sub finish {
27
28 # No data, nothing to do.
29 # Must call SUPER finish to avoid memory leaks
301600ns my $this = shift;
31130µs16µs $this->SUPER::finish(@_);
# spent 6µs making 1 call to Foswiki::I18N::finish
32}
33
34
# spent 277µs within Foswiki::I18N::Fallback::maketext which was called 59 times, avg 5µs/call: # 57 times (270µs+0s) by Foswiki::MAKETEXT at line 57 of /var/www/foswikidev/core/lib/Foswiki/Macros/MAKETEXT.pm, avg 5µs/call # 2 times (8µs+0s) by Foswiki::Plugins::SubscribePlugin::_SUBSCRIBE at line 95 of /var/www/foswikidev/core/lib/Foswiki/Plugins/SubscribePlugin.pm, avg 4µs/call
sub maketext {
355944µs my ( $this, $text, @args ) = @_;
36
37598µs return '' unless $text;
38
39 # substitute parameters:
4059107µs $text =~ s/\[\_(\d+)\]/$args[$1-1]/ge;
41
42 # unescape escaped square brackets:
435920µs $text =~ s/~(\[|\])/$1/g;
44
45 #plurals:
46 $text =~
475923µs s/\[\*,\_(\d+),([^,]+)(,([^,]+))?\]/_handlePlurals($args[$1-1],$2,$4)/ge;
48
4959138µs return $text;
50}
51
52sub _handlePlurals {
53 my ( $number, $singular, $plural ) = @_;
54
55 # bad hack, but Locale::Maketext does it the same way ;)
56 return
57 $number . ' '
58 . (
59 ( $number == 1 )
60 ? $singular
61 : ( $plural ? ($plural) : ( $singular . 's' ) )
62 );
63}
64
65
# spent 2µs within Foswiki::I18N::Fallback::language which was called: # once (2µs+0s) by Foswiki::Plugins::JQueryPlugin::UI::init at line 63 of /var/www/foswikidev/core/lib/Foswiki/Plugins/JQueryPlugin/UI.pm
sub language {
6614µs return 'en';
67}
68
69sub enabled_languages {
70 my $this = shift;
71 return $this->{enabled_languages};
72}
73
74sub fromSiteCharSet {
75 my ( $this, $text ) = @_;
76 return $text;
77}
78
79sub toSiteCharSet {
80 my ( $this, $text ) = @_;
81 return $text;
82}
83
8413µs1;
85__END__