1CGI::Application::PlugiUns:e:rDeCvoPnotpruipb(u3t)ed PerClGID:o:cAupmpelnitcaattiioonn::Plugin::DevPopup(3)
2
3
4
6 CGI::Application::Plugin::DevPopup - Runtime cgiapp info in a popup
7 window
8
10 version 1.06
11
13 End user information
14 This module provides a plugin framework for displaying runtime
15 information about your CGI::Application app in a popup window. A sample
16 Timing plugin is provided to show how it works:
17
18 BEGIN { $ENV{'CAP_DEVPOPUP_EXEC'} = 1; } # turn it on for real
19 use CGI::Application::Plugin::DevPopup;
20 use CGI::Application::Plugin::DevPopup::Timing;
21
22 The rest of your application follows
23 ...
24
25 Now whenever you access a runmode, a window pops up over your content,
26 showing information about how long the various stages have taken.
27 Adding other CAP::DevPopup plugins will get you more information. A
28 HTML::Tidy plugin showing you how your document conforms to W3C
29 standards is available: see CGI::Application::Plugin::HtmlTidy.
30
31 The output consists of a Table of Contents, and a bunch of reports. A
32 rough translation into plain text could look like this:
33
34 Devpopup report for My::App -> add_timing
35
36 * Timings - Total runtime: 3.1178 sec.
37
38 +-----------------------------------------------------------------------+
39 | Timings |
40 +-----------------------------------------------------------------------+
41 | Application started at: Thu Sep 22 02:55:35 2005 |
42 | From To Time taken |
43 |-----------------------------------------------------------------------|
44 | init prerun 0.107513 sec. |
45 | prerun before expensive operation 0.000371 sec. |
46 | before expensive operation after expensive operation 3.006688 sec. |
47 | after expensive operation load_tmpl(dp.html) 0.000379 sec. |
48 | load_tmpl(dp.html) postrun 0.002849 sec. |
49 +-----------------------------------------------------------------------+
50
51 The reports expand and collapse by clicking on the ToC entry or the
52 report header.
53
54 You can see a (developer) version in action here:
55 http://oss.rhesa.com/cpan/cap-devpopup/example
56 <http://oss.rhesa.com/cpan/cap-devpopup/example>.
57
58 Developer information
59 Creating a new plugin for DevPopup is fairly simple. CAP::DevPopup
60 registers a new callback point (named "devpopup_report"), which it
61 uses to collect output from your plugin. You can add a callback to that
62 point, and return your formatted output from there. The callback has
63 this signature:
64
65 sub callback($cgiapp_class, $outputref)
66
67 You pass your output to the devpopup object by calling
68
69 $cgiapp_class->devpopup->add_report(
70 title => $title,
71 summary => $summary,
72 report => $body,
73 );
74
75 You are receiving $outputref, because DevPopup wants to be the last one
76 to be called in the postrun callback. If you had wanted to act at
77 postrun time, then please do so with this variable, and not through a
78 callback at postrun.
79
80 The "on" switch
81 Since this is primarily a development plugin, and you wouldn't want it
82 to run in your production code, an environment variable named
83 CAP_DEVPOPUP_EXEC has to be set to 1 for this module to function, and
84 it must be present at compile time. This means you should place it in a
85 BEGIN{} block, or use SetEnv or PerlSetEnv (remember to set those
86 before any PerlRequire or PerlModule lines).
87
88 Absense of the environment variable turns this module into a no-op:
89 while the plugin and its plugins are still loaded, they won't modify
90 your output.
91
93 o CGI::Application::Plugin::DevPopup::Timing,
94 CGI::Application::Plugin::DevPopup::Log and
95 CGI::Application::Plugin::DevPopup::HTTPHeaders are bundled with this
96 distribution.
97 o CGI::Application::Plugin::HtmlTidy integrates with this module.
98 o CGI::Application::Plugin::TT integrates with this module.
99
101 · devpopup
102
103 This method is the only one exported into your module, and can be
104 used to access the underlying DevPopup object. See below for the
105 methods that this object exposes.
106
108 · add_report( %fields )
109
110 Adds a new report about the current run of the application. The
111 following fields are supported:
112
113 · title
114
115 A short title for your report
116
117 · summary
118
119 An optional one- or two-line summary of your findings
120
121 · report
122
123 Your full output
124
125 · severity
126
127 An optional value specifying the importance of your report.
128 Accepted values are qw/debug info warning error fatal/.
129 This value is used to color-code the report headers.
130
131 · script
132
133 If you have custom javascript, then please pass it in
134 through this field. Otherwise if it's embedded in your
135 report, it will break the popup window. I will take care of
136 the surrounding "<script"> tags, so just the code body is
137 needed.
138
140 INSTALLATION
141
142 To install this module, run:
143
144 cpan CGI::Application::Plugin::DevPopup
145
146 To mnually install this module, run the following commands:
147
148 perl Makefile.PL
149 make
150 make test
151 make install
152
154 CGI::Application. CGI::Application::Plugin::DevPopup::Timing
155
157 Rhesa Rozendaal, rhesa@cpan.org
158
160 Please report any bugs or feature requests to
161 bug-cgi-application-plugin-devpopup@rt.cpan.org, or through the web
162 interface at
163 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-DevPopup
164 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-
165 DevPopup>. I will be notified, and then you'll automatically be
166 notified of progress on your bug as I make changes.
167
169 Mark Stosberg for the initial idea, and for pushing me to write it.
170 Sam Tregar for providing me with the skeleton cgiapp_postrun.
171 Joshua Miller for providing the ::Log plugin.
172 Everybody on the cgiapp mailinglist and on #cgiapp for cheering me on
173 :-)
174
176 Copyright 2005-2007 Rhesa Rozendaal, all rights reserved.
177
178 This program is free software; you can redistribute it and/or modify it
179 under the same terms as Perl itself.
180
181
182
183perl v5.12.0 2010-01-C1G0I::Application::Plugin::DevPopup(3)