Filename | /var/www/foswiki11/lib/Foswiki/Plugins/CommentPlugin.pm |
Statements | Executed 81 statements in 707µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
13 | 1 | 1 | 2.41ms | 2.78ms | commonTagsHandler | Foswiki::Plugins::CommentPlugin::
1 | 1 | 1 | 14µs | 27µs | BEGIN@7 | Foswiki::Plugins::CommentPlugin::
1 | 1 | 1 | 10µs | 16µs | BEGIN@8 | Foswiki::Plugins::CommentPlugin::
1 | 1 | 1 | 9µs | 28µs | BEGIN@13 | Foswiki::Plugins::CommentPlugin::
1 | 1 | 1 | 8µs | 8µs | initPlugin | Foswiki::Plugins::CommentPlugin::
1 | 1 | 1 | 5µs | 5µs | BEGIN@10 | Foswiki::Plugins::CommentPlugin::
1 | 1 | 1 | 4µs | 4µs | BEGIN@11 | Foswiki::Plugins::CommentPlugin::
0 | 0 | 0 | 0s | 0s | beforeSaveHandler | Foswiki::Plugins::CommentPlugin::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | # | ||||
3 | # See Plugin topic for history and plugin information | ||||
4 | |||||
5 | package Foswiki::Plugins::CommentPlugin; | ||||
6 | |||||
7 | 2 | 31µs | 2 | 40µs | # spent 27µs (14+13) within Foswiki::Plugins::CommentPlugin::BEGIN@7 which was called:
# once (14µs+13µs) by Foswiki::Plugin::BEGIN@2.2 at line 7 # spent 27µs making 1 call to Foswiki::Plugins::CommentPlugin::BEGIN@7
# spent 13µs making 1 call to strict::import |
8 | 2 | 26µs | 2 | 22µs | # spent 16µs (10+6) within Foswiki::Plugins::CommentPlugin::BEGIN@8 which was called:
# once (10µs+6µs) by Foswiki::Plugin::BEGIN@2.2 at line 8 # spent 16µs making 1 call to Foswiki::Plugins::CommentPlugin::BEGIN@8
# spent 6µs making 1 call to warnings::import |
9 | |||||
10 | 2 | 19µs | 1 | 5µs | # spent 5µs within Foswiki::Plugins::CommentPlugin::BEGIN@10 which was called:
# once (5µs+0s) by Foswiki::Plugin::BEGIN@2.2 at line 10 # spent 5µs making 1 call to Foswiki::Plugins::CommentPlugin::BEGIN@10 |
11 | 2 | 24µs | 1 | 4µs | # spent 4µs within Foswiki::Plugins::CommentPlugin::BEGIN@11 which was called:
# once (4µs+0s) by Foswiki::Plugin::BEGIN@2.2 at line 11 # spent 4µs making 1 call to Foswiki::Plugins::CommentPlugin::BEGIN@11 |
12 | |||||
13 | 3 | 302µs | 3 | 54µs | # spent 28µs (9+19) within Foswiki::Plugins::CommentPlugin::BEGIN@13 which was called:
# once (9µs+19µs) by Foswiki::Plugin::BEGIN@2.2 at line 13 # spent 28µs making 1 call to Foswiki::Plugins::CommentPlugin::BEGIN@13
# spent 19µs making 1 call to version::import
# spent 7µs making 1 call to version::vxs::declare |
14 | 1 | 300ns | our $RELEASE = '1.1.6'; | ||
15 | 1 | 500ns | our $SHORTDESCRIPTION = | ||
16 | 'Quickly post comments to a page without an edit/save cycle'; | ||||
17 | 1 | 200ns | our $NO_PREFS_IN_TOPIC = 1; | ||
18 | |||||
19 | # spent 8µs within Foswiki::Plugins::CommentPlugin::initPlugin which was called:
# once (8µs+0s) by Foswiki::Plugin::__ANON__[/var/www/foswiki11/lib/Foswiki/Plugin.pm:241] at line 234 of /var/www/foswiki11/lib/Foswiki/Plugin.pm | ||||
20 | |||||
21 | #my ( $topic, $web, $user, $installWeb ) = @_; | ||||
22 | 1 | 8µs | return 1; | ||
23 | } | ||||
24 | |||||
25 | # spent 2.78ms (2.41+372µs) within Foswiki::Plugins::CommentPlugin::commonTagsHandler which was called 13 times, avg 214µs/call:
# 13 times (2.41ms+372µs) by Foswiki::Plugin::invoke at line 294 of /var/www/foswiki11/lib/Foswiki/Plugin.pm, avg 214µs/call | ||||
26 | 13 | 42µs | my ( $text, $topic, $web, $meta ) = @_; | ||
27 | |||||
28 | 13 | 97µs | require Foswiki::Plugins::CommentPlugin::Comment; | ||
29 | |||||
30 | 13 | 41µs | 13 | 189µs | my $query = Foswiki::Func::getCgiQuery(); # spent 189µs making 13 calls to Foswiki::Func::getCgiQuery, avg 15µs/call |
31 | 13 | 5µs | return unless ( defined($query) ); | ||
32 | |||||
33 | 13 | 109µs | return unless $_[0] =~ m/%COMMENT({.*?})?%/o; | ||
34 | |||||
35 | # SMELL: Nasty, tacky way to find out where we were invoked from | ||||
36 | my $scriptname = $ENV{'SCRIPT_NAME'} || ''; | ||||
37 | |||||
38 | # SMELL: unreliable | ||||
39 | my $previewing = ( $scriptname =~ /\/(preview|gnusave|rdiff|compare)/ ); | ||||
40 | Foswiki::Plugins::CommentPlugin::Comment::prompt( $previewing, $_[0], $web, | ||||
41 | $topic ); | ||||
42 | } | ||||
43 | |||||
44 | sub beforeSaveHandler { | ||||
45 | |||||
46 | #my ( $text, $topic, $web ) = @_; | ||||
47 | |||||
48 | require Foswiki::Plugins::CommentPlugin::Comment; | ||||
49 | |||||
50 | my $query = Foswiki::Func::getCgiQuery(); | ||||
51 | return unless $query; | ||||
52 | |||||
53 | my $action = $query->param('comment_action'); | ||||
54 | |||||
55 | return unless ( defined($action) && $action eq 'save' ); | ||||
56 | |||||
57 | # Stop it being applied again | ||||
58 | $query->delete('comment_action'); | ||||
59 | |||||
60 | Foswiki::Plugins::CommentPlugin::Comment::save(@_); | ||||
61 | } | ||||
62 | |||||
63 | 1 | 4µs | 1; | ||
64 | __END__ |