← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:26:36 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Form/Textboxlist.pm
StatementsExecuted 18 statements in 970µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21173µs3.83msFoswiki::Form::Textboxlist::::newFoswiki::Form::Textboxlist::new
11149µs70µsFoswiki::Form::Textboxlist::::BEGIN@9Foswiki::Form::Textboxlist::BEGIN@9
11129µs29µsFoswiki::Form::Textboxlist::::BEGIN@4Foswiki::Form::Textboxlist::BEGIN@4
11117µs25µsFoswiki::Form::Textboxlist::::BEGIN@8Foswiki::Form::Textboxlist::BEGIN@8
11111µs11µsFoswiki::Form::Textboxlist::::BEGIN@6Foswiki::Form::Textboxlist::BEGIN@6
0000s0sFoswiki::Form::Textboxlist::::getDefaultValueFoswiki::Form::Textboxlist::getDefaultValue
0000s0sFoswiki::Form::Textboxlist::::getOptionsFoswiki::Form::Textboxlist::getOptions
0000s0sFoswiki::Form::Textboxlist::::isMultiValuedFoswiki::Form::Textboxlist::isMultiValued
0000s0sFoswiki::Form::Textboxlist::::renderForEditFoswiki::Form::Textboxlist::renderForEdit
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
2package Foswiki::Form::Textboxlist;
3
4276µs129µs
# spent 29µs within Foswiki::Form::Textboxlist::BEGIN@4 which was called: # once (29µs+0s) by Foswiki::Form::createField at line 4
use Foswiki::Form::ListFieldDefinition;
# spent 29µs making 1 call to Foswiki::Form::Textboxlist::BEGIN@4
5117µsour @ISA = qw( Foswiki::Form::ListFieldDefinition );
6246µs111µs
# spent 11µs within Foswiki::Form::Textboxlist::BEGIN@6 which was called: # once (11µs+0s) by Foswiki::Form::createField at line 6
use Foswiki::Plugins::JQueryPlugin ();
# spent 11µs making 1 call to Foswiki::Form::Textboxlist::BEGIN@6
7
8277µs232µs
# spent 25µs (17+8) within Foswiki::Form::Textboxlist::BEGIN@8 which was called: # once (17µs+8µs) by Foswiki::Form::createField at line 8
use strict;
# spent 25µs making 1 call to Foswiki::Form::Textboxlist::BEGIN@8 # spent 7µs making 1 call to strict::import
92679µs291µs
# spent 70µs (49+21) within Foswiki::Form::Textboxlist::BEGIN@9 which was called: # once (49µs+21µs) by Foswiki::Form::createField at line 9
use warnings;
# spent 70µs making 1 call to Foswiki::Form::Textboxlist::BEGIN@9 # spent 21µs making 1 call to warnings::import
10
11
# spent 3.83ms (73µs+3.76) within Foswiki::Form::Textboxlist::new which was called 2 times, avg 1.92ms/call: # 2 times (73µs+3.76ms) by Foswiki::Form::createField at line 311 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Form.pm, avg 1.92ms/call
sub new {
12869µs my $class = shift;
132112µs my $this = $class->SUPER::new(@_);
# spent 112µs making 2 calls to Foswiki::Form::FieldDefinition::new, avg 56µs/call
14
1523.64ms Foswiki::Plugins::JQueryPlugin::createPlugin("textboxlist");
# spent 3.64ms making 2 calls to Foswiki::Plugins::JQueryPlugin::createPlugin, avg 1.82ms/call
16 return $this;
17}
18
19sub isMultiValued { return 1; }
20
21sub getDefaultValue { undef }
22
23sub renderForEdit {
24 my ( $this, $param1, $param2, $param3 ) = @_;
25
26 my $value;
27 my $web;
28 my $topic;
29 my $topicObject;
30 if ( ref($param1) ) { # Foswiki > 1.1
31 $topicObject = $param1;
32 $value = $param2;
33 }
34 else {
35 $web = $param1;
36 $topic = $param2;
37 $value = $param3;
38 }
39
40 my @values = @{ $this->SUPER::getOptions() };
41 my $metadata = '';
42 if (@values) {
43 if ( scalar(@values) == 1 && $values[0] =~ /^https?:/ ) {
44 $metadata = "{autocomplete: '$values[0]'}";
45 }
46 else {
47 $metadata =
48 "{autocomplete: ['"
49 . join( "', '", map { $_ =~ s/(["'])/\\$1/g; $_ } @values )
50 . "']}";
51 }
52 }
53
54 my $field = CGI::textfield(
55 -class =>
56 $this->cssClasses("foswikiInputField jqTextboxList $metadata"),
57 -name => $this->{name},
58 -size => $this->{size},
59 -value => $value,
60 -id => $this->{name},
61 );
62
63 return ( '', $field );
64}
65
66sub getOptions {
67 my $this = shift;
68
69 my $query = Foswiki::Func::getCgiQuery();
70
71 # trick this in
72 my @values = ();
73 my @valuesFromQuery = $query->param( $this->{name} );
74 foreach my $item (@valuesFromQuery) {
75
76 # Item10889: Coming from an "Warning! Confirmation required", often
77 # there's an undef item (the, last, empty, one, <-- here)
78 if ( defined $item ) {
79 foreach my $value ( split( /\s*,\s*/, $item ) ) {
80 push @values, $value if defined $value;
81 }
82 }
83 }
84
85 return \@values;
86}
87
8816µs1;
89__END__