← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:10 2015

Filename/var/www/foswiki11/lib/Foswiki/I18N/Fallback.pm
StatementsExecuted 301 statements in 1.11ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4833260µs260µsFoswiki::I18N::Fallback::::maketextFoswiki::I18N::Fallback::maketext
11133µs40µsFoswiki::I18N::Fallback::::finishFoswiki::I18N::Fallback::finish
11128µs55µsFoswiki::I18N::Fallback::::BEGIN@7Foswiki::I18N::Fallback::BEGIN@7
11120µs20µsFoswiki::I18N::Fallback::::newFoswiki::I18N::Fallback::new
11119µs30µsFoswiki::I18N::Fallback::::BEGIN@8Foswiki::I18N::Fallback::BEGIN@8
1117µs7µsFoswiki::I18N::Fallback::::BEGIN@10Foswiki::I18N::Fallback::BEGIN@10
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::::languageFoswiki::I18N::Fallback::language
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
7256µs281µs
# spent 55µs (28+26) within Foswiki::I18N::Fallback::BEGIN@7 which was called: # once (28µs+26µs) by Foswiki::I18N::new at line 7
use strict;
# spent 55µs making 1 call to Foswiki::I18N::Fallback::BEGIN@7 # spent 26µs making 1 call to strict::import
8247µs240µs
# spent 30µs (19+11) within Foswiki::I18N::Fallback::BEGIN@8 which was called: # once (19µs+11µs) by Foswiki::I18N::new at line 8
use warnings;
# spent 30µs making 1 call to Foswiki::I18N::Fallback::BEGIN@8 # spent 11µs making 1 call to warnings::import
9
102620µs17µs
# spent 7µs within Foswiki::I18N::Fallback::BEGIN@10 which was called: # once (7µs+0s) by Foswiki::I18N::new at line 10
use Foswiki::I18N ();
# spent 7µs making 1 call to Foswiki::I18N::Fallback::BEGIN@10
11118µsour @ISA = ('Foswiki::I18N');
12
13
# spent 20µs within Foswiki::I18N::Fallback::new which was called: # once (20µs+0s) by Foswiki::I18N::new at line 176 of /var/www/foswiki11/lib/Foswiki/I18N.pm
sub new {
1411µs my $class = shift;
15115µs my $this = bless( {}, $class );
16112µs return $this;
17}
18
19
# spent 40µs (33+7) within Foswiki::I18N::Fallback::finish which was called: # once (33µs+7µs) by Foswiki::finish at line 2163 of /var/www/foswiki11/lib/Foswiki.pm
sub finish {
20
21 # No data, nothing to do.
22 # Must call SUPER finish to avoid memory leaks
231500ns my $this = shift;
24128µs17µs $this->SUPER::finish(@_);
# spent 7µs making 1 call to Foswiki::I18N::finish
25}
26
27
# spent 260µs within Foswiki::I18N::Fallback::maketext which was called 48 times, avg 5µs/call: # 33 times (173µs+0s) by Foswiki::MAKETEXT at line 50 of /var/www/foswiki11/lib/Foswiki/Macros/MAKETEXT.pm, avg 5µs/call # 12 times (64µs+0s) by Foswiki::Search::formatResult at line 1195 of /var/www/foswiki11/lib/Foswiki/Search.pm, avg 5µs/call # 3 times (24µs+0s) by Foswiki::Meta::haveAccess at line 1812 of /var/www/foswiki11/lib/Foswiki/Meta.pm, avg 8µs/call
sub maketext {
284858µs my ( $this, $text, @args ) = @_;
29
30489µs return '' unless $text;
31
32 # substitute parameters:
334851µs $text =~ s/\[\_(\d+)\]/$args[$1-1]/ge;
34
35 # unescape escaped square brackets:
364822µs $text =~ s/~(\[|\])/$1/g;
37
38 #plurals:
39 $text =~
404816µs s/\[\*,\_(\d+),([^,]+)(,([^,]+))?\]/_handlePlurals($args[$1-1],$2,$4)/ge;
41
4248151µs return $text;
43}
44
45sub _handlePlurals {
46 my ( $number, $singular, $plural ) = @_;
47
48 # bad hack, but Locale::Maketext does it the same way ;)
49 return
50 $number . ' '
51 . (
52 ( $number == 1 )
53 ? $singular
54 : ( $plural ? ($plural) : ( $singular . 's' ) )
55 );
56}
57
58sub language {
59 return 'en';
60}
61
62sub enabled_languages {
63 my $this = shift;
64 return $this->{enabled_languages};
65}
66
67sub fromSiteCharSet {
68 my ( $this, $text ) = @_;
69 return $text;
70}
71
72sub toSiteCharSet {
73 my ( $this, $text ) = @_;
74 return $text;
75}
76
7716µs1;
78__END__