Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Form/Radio.pm |
Statements | Executed 15 statements in 539µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 52µs | 118µs | new | Foswiki::Form::Radio::
1 | 1 | 1 | 34µs | 42µs | BEGIN@4 | Foswiki::Form::Radio::
1 | 1 | 1 | 21µs | 43µs | BEGIN@5 | Foswiki::Form::Radio::
1 | 1 | 1 | 9µs | 9µs | BEGIN@7 | Foswiki::Form::Radio::
1 | 1 | 1 | 2µs | 2µs | CORE:subst (opcode) | Foswiki::Form::Radio::
0 | 0 | 0 | 0s | 0s | renderForEdit | Foswiki::Form::Radio::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki::Form::Radio; | ||||
3 | |||||
4 | 2 | 52µs | 2 | 51µs | # spent 42µs (34+9) within Foswiki::Form::Radio::BEGIN@4 which was called:
# once (34µs+9µs) by Foswiki::Form::createField at line 4 # spent 42µs making 1 call to Foswiki::Form::Radio::BEGIN@4
# spent 9µs making 1 call to strict::import |
5 | 2 | 48µs | 2 | 66µs | # spent 43µs (21+23) within Foswiki::Form::Radio::BEGIN@5 which was called:
# once (21µs+23µs) by Foswiki::Form::createField at line 5 # spent 43µs making 1 call to Foswiki::Form::Radio::BEGIN@5
# spent 22µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 366µs | 1 | 9µs | # spent 9µs within Foswiki::Form::Radio::BEGIN@7 which was called:
# once (9µs+0s) by Foswiki::Form::createField at line 7 # spent 9µs making 1 call to Foswiki::Form::Radio::BEGIN@7 |
8 | 1 | 14µs | our @ISA = ('Foswiki::Form::ListFieldDefinition'); | ||
9 | |||||
10 | # spent 118µs (52+66) within Foswiki::Form::Radio::new which was called:
# once (52µs+66µs) by Foswiki::Form::createField at line 311 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Form.pm | ||||
11 | 1 | 2µs | my $class = shift; | ||
12 | 1 | 24µs | 1 | 64µs | my $this = $class->SUPER::new(@_); # spent 64µs making 1 call to Foswiki::Form::FieldDefinition::new |
13 | 1 | 2µs | $this->{size} ||= 0; | ||
14 | 1 | 13µs | 1 | 2µs | $this->{size} =~ s/\D//g; # spent 2µs making 1 call to Foswiki::Form::Radio::CORE:subst |
15 | 1 | 2µs | $this->{size} ||= 0; | ||
16 | |||||
17 | # SMELL: Non-zero -columns attribute forces CGI::radio_group() to use | ||||
18 | # HTML3 tables for layout | ||||
19 | 1 | 3µs | $this->{size} = 4 if ( $this->{size} < 1 ); | ||
20 | |||||
21 | 1 | 7µs | return $this; | ||
22 | } | ||||
23 | |||||
24 | sub renderForEdit { | ||||
25 | my ( $this, $topicObject, $value ) = @_; | ||||
26 | |||||
27 | my $selected = ''; | ||||
28 | my $session = $this->{session}; | ||||
29 | my %attrs; | ||||
30 | foreach my $item ( @{ $this->getOptions() } ) { | ||||
31 | $attrs{$item} = { | ||||
32 | class => $this->cssClasses('foswikiRadioButton'), | ||||
33 | title => $topicObject->expandMacros($item) | ||||
34 | }; | ||||
35 | |||||
36 | $selected = $item if ( $item eq $value ); | ||||
37 | } | ||||
38 | |||||
39 | return ( | ||||
40 | '', | ||||
41 | CGI::radio_group( | ||||
42 | -name => $this->{name}, | ||||
43 | -values => $this->getOptions(), | ||||
44 | -default => $selected, | ||||
45 | -columns => $this->{size}, | ||||
46 | -attributes => \%attrs | ||||
47 | ) | ||||
48 | ); | ||||
49 | } | ||||
50 | |||||
51 | 1 | 6µs | 1; | ||
52 | __END__ | ||||
# spent 2µs within Foswiki::Form::Radio::CORE:subst which was called:
# once (2µs+0s) by Foswiki::Form::Radio::new at line 14 |