libplack-middleware-debug-perl-0.16+dfsg.orig/0000755000175000017500000000000012330540277017043 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/README0000644000175000017500000001437512212420730017723 0ustar fsfsNAME Plack::Middleware::Debug - display information about the current request/response SYNOPSIS enable "Debug"; DESCRIPTION The debug middleware offers a configurable set of panels that displays information about the current request and response. The information is generated only for responses with a status of 200 ("OK") and a "Content-Type" that contains "text/html" or "application/xhtml+xml" and is embedded in the HTML that is sent back to the browser. Also the code is injected directly before the "" tag so if there is no such tag, the information will not be injected. To enable the middleware, just use Plack::Builder as usual in your ".psgi" file: use Plack::Builder; builder { enable 'Debug', panels => [ qw(DBITrace Memory Timer) ]; $app; }; The "Debug" middleware takes an optional "panels" argument whose value is expected to be a reference to an array of panel specifications. If given, only those panels will be enabled. If you don't pass a "panels" argument, the default list of panels - "Environment", "Response", "Timer", "Memory", "Session" and "DBITrace" - will be enabled, each with their default settings, and automatically disabled if their targer modules or middleware components are not loaded. Each panel specification can take one of three forms: A string This is interpreted as the base name of a panel in the "Plack::Middeware::Debug::" namespace. The panel class is loaded and a panel object is created with its default settings. An array reference If you need to pass arguments to the panel object as it is created, you may use this form (But see below). The first element of the array reference has to be the panel base name. The remaining elements are key/value pairs to be passed to the panel. For example: builder { enable 'Debug', panels => [ qw(Environment Response Timer Memory), [ 'DBITrace', level => 2 ] ]; $app; }; Because each panel is a middleware component, you can write this way as well: builder { enable 'Debug'; # load defaults enable 'Debug::DBITrace', level => 2; $app; }; Note that the " line should come before other Debug panels because of the order middleware components are executed. Custom middleware You can also pass a Panel middleware component. This might be useful if you have custom debug panels in your framework or web application. HOW TO WRITE YOUR OWN DEBUG PANEL The "Debug" middleware is designed to be easily extensible. You might want to write a custom debug panel for your framework or for your web application. Each debug panel is also a Plack middleware copmonent and is easy to write one. Let's look at the anatomy of the "Timer" debug panel. Here is the code from that panel: package Plack::Middleware::Debug::Timer; use Time::HiRes; use parent qw(Plack::Middleware::Debug::Base); sub run { my($self, $env, $panel) = @_; my $start = [ Time::HiRes::gettimeofday ]; return sub { my $res = shift; my $end = [ Time::HiRes::gettimeofday ]; my $elapsed = sprintf '%.6f s', Time::HiRes::tv_interval $start, $end; $panel->nav_subtitle($elapsed); $panel->content( $self->render_list_pairs( [ Start => $self->format_time($start), End => $self->format_time($end), Elapsed => $elapsed ], ), ); }; } sub format_time { ... } To write a new debug panel, place it in the "Plack::Middleware::Debug::" namespace. In our example, the "Timer" panel lives in the "Plack::Middleware::Debug::Timer" package. The only thing your panel should do is to subclass Plack::Middleware::Debug::Base. This does most of the things a middleware component should do as a Plack middleware, so you only need to override "run" method to profile and create the panel content. sub run { my($self, $env, $panel) = @_; # Do something before the application runs return sub { my $res = shift; # Do something after the application returns }; } You can create as many lexical variables as you need and reference that in the returned callback as a closure, and update the content of of the $panel which is Plack::Middleware::Debug::Panel object. In our "Timer" example we want to list three key/value pairs: the start time, the end time and the elapsed time. We use the "render_list_pairs()" method to place the pairs in the order we want. There is also a "render_hash()" and "render_lines()" method, to render a hash keys and values, as well as just text lines (e.g. log messages). BUGS AND LIMITATIONS Please report any bugs or feature requests through the web interface at . INSTALLATION See perlmodinstall for information and options on installing Perl modules. AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit to find a CPAN site near you. Or see . The development version lives at . Instead of sending patches, please fork this project using the standard git and github infrastructure. AUTHORS Marcel Grunauer, "" Tatsuhiko Miyagawa, "" COPYRIGHT AND LICENSE Copyright 2009 by Marcel Grnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO The debug middleware is heavily influenced (that is, adapted from) the Django Debug Toolbar - see . libplack-middleware-debug-perl-0.16+dfsg.orig/Build.PL0000644000175000017500000000007112212420730020323 0ustar fsfsuse 5.008001; use Module::Build::Tiny 0.026; Build_PL(); libplack-middleware-debug-perl-0.16+dfsg.orig/Changes0000644000175000017500000000534612212420730020334 0ustar fsfsRevision history for Perl extension Plack-Middleware-Debug 0.16 2013-09-06 11:41:25 PDT - Merge with upstream 0.15 2013-09-06 11:37:24 PDT - Convert to Milla - Fix broken latin-1 META.yml 0.14 Sun Sep 18 12:51:49 PDT 2011 - Fixed warnings (chiselwright) 0.13 Mon Jul 18 13:57:27 PDT 2011 - Fixed the way $spec mangling works (Jon Swartz) 0.12 Mon Mar 28 16:20:54 PDT 2011 - Added experimental TrackObjects panel - Fixed UUV warnings for Catalyst (jjn1016) 0.11 Fri Jan 14 10:54:53 PST 2011 - Fixed memory leaks in Parameters panel (jnap) - Fixed memory leaks in responses not HTML/XML (forwardever) 0.10 Wed Aug 25 12:43:54 PDT 2010 - Support panels in non-200 responses as well since they're useful for debugging anyway (haarg) 0.09 Tue May 4 16:24:09 PDT 2010 - Added new Parameters panel (franckcuny) 0.08 Sat May 1 04:56:08 PDT 2010 - Update Encode.pm dependency RT #57087 (jnareb) - Fixed packages - Moved git URL 0.07 Wed Feb 3 09:53:56 PST 2010 - No code change. Fixes the packaging issue due to the Module::Install::Share bug 0.06 Sat Jan 30 05:21:21 PST 2010 - Fixes UTF-8 issues when panels such as Env contains UTF-8 wide characters (Thanks to tomyhero) 0.05 Sat Jan 30 00:24:39 PST 2010 - Major refactoring of middleware panels: Now panels are also middleware - Support streaming interface as well (clkao) - Added Session middleware panel 0.04 Tue 2009.12.15 22:25:16 CET (Marcel Gruenauer ) - fixed 'uninitialized' warnings for undef values in vardump() (hanekomu) - fix POD typos (hanekomu) 0.03 Sun 2009.12.13 23:49:53 CET (Marcel Gruenauer ) - added CatalystLog panel (hanekomu, miyagawa) - Added ability to pass arguments and objects to panels (hanekomu) - circumvented a bug in Data::Dump(er) related typeglobs (miyagawa) - DBITrace panel takes an optional 'level' argument (trace level) (hanekomu) - nav_title() defaults to title() now, so need to set it in most panels (hanekomu) - added documentation (hanekomu) - fix a memory leak by declaring renderer only once (miyagawa) - added very basic tests (hanekomu) - Environment panel does its work in process_response() now - various small bug fixes and improvements (miyagawa, hanekomu) - refactoring (hanekomu) 0.02 Sun 2009.12.13 12:01:29 CET (Marcel Gruenauer ) - For debug information to be sent, the Content-Type should contain 'text/html'; it's not necessary that it's equal to it. So 'text/html; charset=utf-8' is ok as well (thanks tomyhero) 0.01 Sun 2009.12.13 01:12:58 CET (Marcel Gruenauer ) - original version libplack-middleware-debug-perl-0.16+dfsg.orig/examples/0000755000175000017500000000000012330540277020661 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/examples/dbi/0000755000175000017500000000000012330540277021417 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/examples/dbi/dump.sql0000644000175000017500000000021212212420730023066 0ustar fsfsBEGIN TRANSACTION; CREATE TABLE foo (id integer, foo text); INSERT INTO "foo" VALUES(1,'bar'); INSERT INTO "foo" VALUES(2,'xxx'); COMMIT; libplack-middleware-debug-perl-0.16+dfsg.orig/examples/dbi/app.psgi0000644000175000017500000000112212212420730023045 0ustar fsfs# Do this: sqlite3 examples/dbi/foo.db < examples/dbi/dump.sql use Plack::Builder; use File::Basename; my $db = File::Basename::dirname(__FILE__) . "/foo.db"; my $app = sub { use DBI; my $dbh = DBI->connect("dbi:SQLite:dbname=$db", "", ""); my $sth = $dbh->prepare("SELECT * FROM foo"); $sth->execute; 1 while ($sth->fetchrow_arrayref); return [ 200, [ 'Content-Type' => 'text/html' ], ['Hello World'] ]; }; builder { enable 'Debug', panels => [qw(Environment Response Timer Memory), [ 'DBITrace', level => 2 ]]; $app; }; libplack-middleware-debug-perl-0.16+dfsg.orig/examples/hello-world/0000755000175000017500000000000012212420730023077 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/examples/hello-world/app.psgi0000644000175000017500000000025312212420730024543 0ustar fsfsuse Plack::Builder; my $app = sub { return [ 200, [ 'Content-Type' => 'text/html' ], [ 'Hello World' ] ]; }; builder { enable 'Debug'; $app; }; libplack-middleware-debug-perl-0.16+dfsg.orig/META.yml0000644000175000017500000000252212212420730020303 0ustar fsfs--- abstract: 'display information about the current request/response' author: - 'Marcel Grunauer, C<< >>' build_requires: Test::More: 0.70 configure_requires: Module::Build::Tiny: 0.026 dynamic_config: 0 generated_by: 'Dist::Milla version v1.0.4, Dist::Zilla version 4.300037, CPAN::Meta::Converter version 2.132140' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Plack-Middleware-Debug no_index: directory: - t - xt - inc - share - eg - examples requires: Class::Method::Modifiers: 1.05 Data::Dump: 0 Encode: 2.23 File::ShareDir: 1.00 Plack: 0 Text::MicroTemplate: 0.15 parent: 0 perl: 5.008001 resources: bugtracker: https://github.com/miyagawa/Plack-Middleware-Debug/issues homepage: https://github.com/miyagawa/Plack-Middleware-Debug repository: https://github.com/miyagawa/Plack-Middleware-Debug.git version: 0.16 x_contributors: - 'Andreas Marienborg ' - 'Chisel ' - 'Graham Knop ' - 'John Napiorkowski ' - 'Jonathan Swartz ' - 'Marcel Gruenauer ' - 'Olaf Alders ' - 'Tatsuhiko Miyagawa ' - 'franck cuny ' libplack-middleware-debug-perl-0.16+dfsg.orig/share/0000755000175000017500000000000012330540277020145 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/0000755000175000017500000000000012330540277022755 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/back.png0000644000175000017500000000201712212420730024351 0ustar fsfsPNG  IHDR"":G tEXtSoftwareAdobe ImageReadyqe<IDATxXOA])!MH`$ ;W#< 9p1phHr6~4a$6M!v2;3ݶ|/μ7ݕZ8 N?L3$np|$XKW=@G$`𶑓ܠO%ՒY{ } \N+#s dYBzV uE  P#B yr(;Xl2D Q*K@iH=+~Fa8  scш4:/.1(;~Ǒpn$AnЁ+v8=g"mQX/؛[ý. ?S9N|`σ=8Z1;pqRz~ƅe1)*nZ+k'NgN`Hr"7U _QA;a6 VoFsE87 :]T¹6'}y\ɨZw Yzb"ͱ4B'c֦wӲJsz)X&r6c2h'''J;b98%)yFd2ge計>hE =Jt:ma@oS;`_'Eji5˲drPLWErc*)schtC 6 bw_q@i;πck@z iC|/췄{\?jbQ򾅋q?j+C+?IENDB`libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/information.gif0000644000175000017500000000201312212420730025753 0ustar fsfsGIF89a<< """)))333:::EEEKKKTTTZZZbbbkkksssxxx! ,<<@pH,Ȥrl:A`JZج:HxL.Et4Nö}ou~C`j z|  v{qto  oqgϧpe  ޙnc aaL@ 2deAZ Wy2b /L08Az fDžbTbXR*3 4*LS֍HS MuX&B!D25f0悩d\1S3 H&@ &(@̀ <51z3](SV_0fRƂ)c06'(Ԁ0&+&@ۜd( Lx L|8:3;Sѓ*#˙/nj?l|ݔvtJ4<ۘr9`J?omvLlFv Z& 7`L) LF{x nyHXv,#}d4peW8MtFD9GgIRp WX&,@gT M%PIƗ 1)% Bflbb~Erj)z>@x@ $5lЀ(y4&\$&p@7thC P \*]1K0ð,-u)ƪR4K%lI|*! 0#BI;(ئ+E+Q;/[S lM;libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/toolbar.min.js0000644000175000017500000000641612212420730025534 0ustar fsfsjQuery.noConflict();jQuery(function(b){var a="plack_debug_panel";b.plDebug=function(d,c){b.plDebug.init()};b.extend(b.plDebug,{init:function(){var c=null;b("#plDebugPanelList li a").click(function(){if(!this.className){return false}c=b("#plDebug #"+this.className);if(c.is(":visible")){b(document).trigger("close.plDebug");b(this).parent().removeClass("active")}else{b(".panelContent").hide();c.show();b.plDebug.open();b("#plDebugToolbar li").removeClass("active");b(this).parent().addClass("active")}return false});b("#plDebug a.plDebugClose").click(function(){b(document).trigger("close.plDebug");b("#plDebugToolbar li").removeClass("active");return false});b("#plDebug a.remoteCall").click(function(){b("#plDebugWindow").load(this.href,{},function(){b("#plDebugWindow a.plDebugBack").click(function(){b(this).parent().parent().hide();return false})});b("#plDebugWindow").show();return false});b("#plDebugTemplatePanel a.plTemplateShowContext").click(function(){b.plDebug.toggle_arrow(b(this).children(".toggleArrow"));b.plDebug.toggle_content(b(this).parent().next());return false});b("#plDebugSQLPanel a.plSQLShowStacktrace").click(function(){b.plDebug.toggle_content(b(".plSQLHideStacktraceDiv",b(this).parents("tr")));return false});b("#plHideToolBarButton").click(function(){b.plDebug.hide_toolbar(true);return false});b("#plShowToolBarButton").click(function(){b.plDebug.show_toolbar();return false});if(b.cookie(a)){b.plDebug.hide_toolbar(false)}else{b.plDebug.show_toolbar(false)}},open:function(){},toggle_content:function(c){if(c.is(":visible")){c.hide()}else{c.show()}},close:function(){b(document).trigger("close.plDebug");return false},hide_toolbar:function(c){b("#plDebugWindow").hide();b(".panelContent").hide();b("#plDebugToolbar li").removeClass("active");b("#plDebugToolbar").hide("fast");b("#plDebugToolbarHandle").show();b(document).unbind("keydown.plDebug");if(c){b.cookie(a,"hide",{path:"/",expires:10})}},show_toolbar:function(c){b(document).bind("keydown.plDebug",function(d){if(d.keyCode==27){b.plDebug.close()}});b("#plDebugToolbarHandle").hide();if(c){b("#plDebugToolbar").show("fast")}else{b("#plDebugToolbar").show()}b.cookie(a,null,{path:"/",expires:-1})},toggle_arrow:function(d){var c=String.fromCharCode(9654);var e=String.fromCharCode(9660);d.html(d.html()==c?e:c)}});b(document).bind("close.plDebug",function(){if(b("#plDebugWindow").is(":visible")){b("#plDebugWindow").hide();return}if(b(".panelContent").is(":visible")){b(".panelContent").hide();return}if(b("#plDebugToolbar").is(":visible")){b.plDebug.hide_toolbar(true);return}})});jQuery(function(){jQuery.plDebug()});jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;ha,#plDebug #plDebugToolbar li>div.contentless{font-weight:normal;font-style:normal;text-decoration:none;display:block;font-size:16px;padding:10px 10px 5px 25px;color:#fff;}#plDebug #plDebugToolbar li a:hover{color:#111;background-color:#ffc;}#plDebug #plDebugToolbar li.active{background-image:url(indicator.png);background-repeat:no-repeat;background-position:left center;background-color:#333;padding-left:10px;}#plDebug #plDebugToolbar li.active a:hover{color:#b36a60;background-color:transparent;}#plDebug #plDebugToolbar li small{font-size:12px;color:#999;font-style:normal;text-decoration:none;font-variant:small-caps;}#plDebug #plDebugToolbarHandle{position:fixed;background:#fff;border:1px solid #111;top:30px;right:0;z-index:100000000;opacity:.75;}#plDebug a#plShowToolBarButton{display:block;height:60px;width:60px;border-right:none;border-bottom:4px solid #fff;border-top:4px solid #fff;border-left:4px solid #fff;color:#fff;font-size:10px;font-weight:bold;text-decoration:none;text-align:center;text-indent:-999999px;background:#000 url(information.gif) no-repeat left center;opacity:.5;}#plDebug a#plShowToolBarButton:hover{background-color:#000;padding-right:6px;border-top-color:#FFE761;border-left-color:#FFE761;border-bottom-color:#FFE761;opacity:1.0;}#plDebug pre{overflow:auto;font-family:monospace,serif;}#plDebug tr.plDebugOdd{background-color:#f5f5f5;}#plDebug .panelContent{display:none;position:fixed;margin:0;top:0;right:200px;bottom:0;left:0;background-color:#eee;color:#666;z-index:100000000;}#plDebug .panelContent>div{border-bottom:1px solid #ddd;}#plDebug .plDebugPanelTitle{position:absolute;background-color:#ffc;color:#666;padding-left:20px;top:0;right:0;left:0;height:50px;}#plDebug .plDebugPanelContent{position:absolute;top:50px;right:0;bottom:0;left:0;height:auto;padding:0 0 0 20px;}#plDebug .plDebugPanelContent .scroll{height:100%;overflow:auto;display:block;padding:0 10px 0 0;}#plDebug h3{font-size:24px;font-weight:normal;line-height:50px;}#plDebug h4{font-size:20px;font-weight:bold;margin-top:.8em;}#plDebug .panelContent table{border:1px solid #ccc;border-collapse:collapse;width:100%;background-color:#fff;margin-top:.8em;overflow:auto;}#plDebug .panelContent tbody td,#plDebug .panelContent tbody th{vertical-align:top;padding:2px 3px;}#plDebug .panelContent thead th{padding:1px 6px 1px 3px;text-align:left;font-weight:bold;font-size:14px;}#plDebug .panelContent tbody th{width:12em;text-align:right;color:#666;padding-right:.5em;}#plDebug .panelContent code{font-family:Consolas,Monaco,"Bitstream Vera Sans Mono","Lucida Console",monospace;}#plDebug .panelContent .plDebugClose{text-indent:-9999999px;display:block;position:absolute;top:4px;right:15px;height:40px;width:40px;background:url(close.png) no-repeat center center;}#plDebug .panelContent .plDebugClose:hover{background-image:url(close_hover.png);}#plDebug .panelContent .plDebugClose.plDebugBack{background-image:url(back.png);}#plDebug .panelContent .plDebugClose.plDebugBack:hover{background-image:url(back_hover.png);}#plDebug .panelContent dt,#plDebug .panelContent dd{display:block;}#plDebug .panelContent dt{margin-top:.75em;}#plDebug .panelContent dd{margin-left:10px;}#plDebug a.toggleTemplate{padding:4px;background-color:#bbb;-moz-border-radius:3px;-webkit-border-radius:3px;}#plDebug a.toggleTemplate:hover{padding:4px;background-color:#444;color:#ffe761;-moz-border-radius:3px;-webkit-border-radius:3px;}#plDebug a.plTemplateShowContext,#plDebug a.plTemplateShowContext span.toggleArrow{color:#999;}#plDebug a.plTemplateShowContext:hover,#plDebug a.plTemplateShowContext:hover span.toggleArrow{color:#000;cursor:pointer;}#plDebug .plDebugSqlWrap{position:relative;}#plDebug .plDebugSql{z-index:100000002;}#plDebug .plSQLHideStacktraceDiv tbody th{text-align:left;}#plDebug span.plDebugLineChart{border-top:3px solid #777;position:absolute;bottom:0;top:0;left:0;display:block;z-index:1000000001;}#plDebug span.plDebugLineChartWarning{border-top-color:#900;}#plDebug .highlight{color:#000;}#plDebug .highlight .err{color:#000;}#plDebug .highlight .g{color:#000;}#plDebug .highlight .k{color:#000;font-weight:bold;}#plDebug .highlight .o{color:#000;}#plDebug .highlight .n{color:#000;}#plDebug .highlight .mi{color:#000;font-weight:bold;}#plDebug .highlight .l{color:#000;}#plDebug .highlight .x{color:#000;}#plDebug .highlight .p{color:#000;}#plDebug .highlight .m{color:#000;font-weight:bold;}#plDebug .highlight .s{color:#333;}#plDebug .highlight .w{color:#888;}#plDebug .highlight .il{color:#000;font-weight:bold;}#plDebug .highlight .na{color:#333;}#plDebug .highlight .nt{color:#000;font-weight:bold;}#plDebug .highlight .nv{color:#333;}#plDebug .highlight .s2{color:#333;}#plDebug .highlight .cp{color:#333;}libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/jquery.cookie.js0000644000175000017500000001022612212420730026071 0ustar fsfs/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } };libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/panel_bg.png0000644000175000017500000000015612212420730025222 0ustar fsfsPNG  IHDRĉtEXtSoftwareAdobe ImageReadyqe<IDATxb3 EOIENDB`libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/close.png0000644000175000017500000000202512212420730024555 0ustar fsfsPNG  IHDR"":G tEXtSoftwareAdobe ImageReadyqe<IDATxڬXOA҅J4@F !B޹{0у!".F WF>-M[>Rhimt~nwmJ@HbdbbiᏁ̜OmybN *𵙒d! ⑄*1Gjot.wVͲ+YjRUUEm ,z!F" _ #1AZ”A^|P2S?j{@y||3 łLY90#Ft2373@2ZQ,D8]VhA&2Oe#B~F:6>C65dц=\#"1؉RTڬJ2W#BUtMކD$HPrPol#ɶ=QҘT~H$b 6Iضm ؞$"ͪlqjHq,4vl'h+t{ܶxi2MaSSKghh;CDԻzvY'''7| E'S k[Zh$'P|FB%bHQR5vR>%chh* Ys` g脱+' JG T,+鶶{ngzw9ns>==Wt:!AB#u‡l6 q|3A)R!&c (" N"nN椞qCo3JHH5)b$oE:ީ8:4>|*\jsznJپET)r2Vtٟz y7$K ;8 ^?.Esft5hslD4FW* azx߂ӄXKWq`mzbe |rIYŰZubk*p\. `v[wrPkQ kC^H̖.ɰ ]#YWBh+k  }G hЮ3֫ͅH5!d{A@Lc6(<\ 2k|VJ3Mm"Sc-no{?^ׄKDx|{ 2Bch煖:y@D2  0oFB~BYEe^u Ah/,Px**rnik-,2 ༊\!n51 dbnN4/DsQ1q7BIf(\&#X!lݵWXz2Nd'=%K|B dodu7r?5?dWR:e{t!}VtKk%67~H%Ln,(!MB^m7IW^db(Μi%IƷso?xss9IY} R!l3+ů(1sduI@T¿:ϵvDA'wdwx$T1ВN5$2;Cynni1<$윈Q}bTD~##61W_!Ƣ!aYY!37;#{O#Ci9*//jDlN-΍LOt!/v8 8;'6wq?j\9 By:fM*b-Yy&BNNW M 4\lNXT;ZYޢe!/LC+3\j- mS+͘XQ=xDs~2 Y DVDzǝpQG"E1=Ң(E(-dn' p$~eௗ\_F!`CD܋zcƅ.;GD&z:c~v5ȉ܌y#$ӭ鬼PU޾x̾dGzAv7N ou݄wdƎ0WUs4A5<`oG(c\m841'1zD'?*"Q1t*VRѐ6P4{룏lͪ&yN+T镓gQΚR9q!G5"ǀA},'j `ACYB ˖Tz8:Ͷ3m~՗NIh5!`h}Х}rd?Ԡ,&~#KnIENDB`libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/indicator.png0000644000175000017500000000113712212420730025427 0ustar fsfsPNG  IHDR tEXtSoftwareAdobe ImageReadyqe<IDATxڔMKa]_z^ tx)/ ^ă$! ;ZAvCPx訂"A$AZ[kH1>n4cٗ33p&i0ӏ)t  B`9Jbv``+C+4K>pB ,H  TT@_ ;?12ɫTNS gVE@^*Qjmrt(:wp&) ܲ$Ir6N$w ǵXbAժ}4'p{(9ĴUp<~T: .ܪM]ݖ gp8~}Cd"HLNBFD33HT'M>SsoQh u(t44M++2{^-eqU1F9"2k^|2CƤ_v6 }ubBh4sO!QN3g-B DIENDB`libplack-middleware-debug-perl-0.16+dfsg.orig/share/debug_toolbar/toolbar.css0000644000175000017500000002004312212420730025116 0ustar fsfs/* Debug Toolbar CSS Reset, adapted from Eric Meyer's CSS Reset */ #plDebug {color:#000;background:#FFF;} #plDebug, #plDebug div, #plDebug span, #plDebug applet, #plDebug object, #plDebug iframe, #plDebug h1, #plDebug h2, #plDebug h3, #plDebug h4, #plDebug h5, #plDebug h6, #plDebug p, #plDebug blockquote, #plDebug pre, #plDebug a, #plDebug abbr, #plDebug acronym, #plDebug address, #plDebug big, #plDebug cite, #plDebug code, #plDebug del, #plDebug dfn, #plDebug em, #plDebug font, #plDebug img, #plDebug ins, #plDebug kbd, #plDebug q, #plDebug s, #plDebug samp, #plDebug small, #plDebug strike, #plDebug strong, #plDebug sub, #plDebug sup, #plDebug tt, #plDebug var, #plDebug b, #plDebug u, #plDebug i, #plDebug center, #plDebug dl, #plDebug dt, #plDebug dd, #plDebug ol, #plDebug ul, #plDebug li, #plDebug fieldset, #plDebug form, #plDebug label, #plDebug legend, #plDebug table, #plDebug caption, #plDebug tbody, #plDebug tfoot, #plDebug thead, #plDebug tr, #plDebug th, #plDebug td { margin:0; padding:0; border:0; outline:0; font-size:12px; line-height:1.5em; color:#000; vertical-align:baseline; background:transparent; font-family:sans-serif; text-align:left; } #plDebug #plDebugToolbar { background:#111; width:200px; z-index:100000000; position:fixed; top:0; bottom:0; right:0; opacity:0.9; } #plDebug #plDebugToolbar small { color:#999; } #plDebug #plDebugToolbar ul { margin:0; padding:0; list-style:none; } #plDebug #plDebugToolbar li { border-bottom:1px solid #222; color:#fff; display:block; font-weight:bold; float:none; margin:0; padding:0; position:relative; width:auto; } #plDebug #plDebugToolbar li>a, #plDebug #plDebugToolbar li>div.contentless { font-weight:normal; font-style:normal; text-decoration:none; display:block; font-size:16px; padding:10px 10px 5px 25px; color:#fff; } #plDebug #plDebugToolbar li a:hover { color:#111; background-color:#ffc; } #plDebug #plDebugToolbar li.active { background-image:url(indicator.png); background-repeat:no-repeat; background-position:left center; background-color:#333; padding-left:10px; } #plDebug #plDebugToolbar li.active a:hover { color:#b36a60; background-color:transparent; } #plDebug #plDebugToolbar li small { font-size:12px; color:#999; font-style:normal; text-decoration:none; font-variant:small-caps; } #plDebug #plDebugToolbarHandle { position:fixed; background:#fff; border:1px solid #111; top:30px; right:0; z-index:100000000; opacity:0.75; } #plDebug a#plShowToolBarButton { display:block; height:60px; width:60px; border-right:none; border-bottom:4px solid #fff; border-top:4px solid #fff; border-left:4px solid #fff; color:#fff; font-size:10px; font-weight:bold; text-decoration:none; text-align:center; text-indent:-999999px; background:#000 url(information.gif) no-repeat left center; opacity:0.5; } #plDebug a#plShowToolBarButton:hover { background-color:#000; padding-right:6px; border-top-color:#FFE761; border-left-color:#FFE761; border-bottom-color:#FFE761; opacity:1.0; } #plDebug pre { overflow:auto; font-family:monospace,serif; } #plDebug tr.plDebugOdd { background-color:#f5f5f5; } #plDebug .panelContent { display:none; position:fixed; margin:0; top:0; right:200px; bottom:0; left:0px; background-color:#eee; color:#666; z-index:100000000; } #plDebug .panelContent > div { border-bottom:1px solid #ddd; } #plDebug .plDebugPanelTitle { position:absolute; background-color:#ffc; color:#666; padding-left:20px; top:0; right:0; left:0; height:50px; } #plDebug .plDebugPanelContent { position:absolute; top:50px; right:0; bottom:0; left:0; height:auto; padding:0 0 0 20px; } #plDebug .plDebugPanelContent .scroll { height:100%; overflow:auto; display:block; padding:0 10px 0 0; } #plDebug h3 { font-size:24px; font-weight:normal; line-height:50px; } #plDebug h4 { font-size:20px; font-weight:bold; margin-top:0.8em; } #plDebug .panelContent table { border:1px solid #ccc; border-collapse:collapse; width:100%; background-color:#fff; margin-top:0.8em; overflow: auto; } #plDebug .panelContent tbody td, #plDebug .panelContent tbody th { vertical-align:top; padding:2px 3px; } #plDebug .panelContent thead th { padding:1px 6px 1px 3px; text-align:left; font-weight:bold; font-size:14px; } #plDebug .panelContent tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } #plDebug .panelContent code { font-family:Consolas, Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace; } /* #plDebug .panelContent p a:hover, #plDebug .panelContent dd a:hover { color:#111; background-color:#ffc; } #plDebug .panelContent p { padding:0 5px; } #plDebug .panelContent p, #plDebug .panelContent table, #plDebug .panelContent ol, #plDebug .panelContent ul, #plDebug .panelContent dl { margin:5px 0 15px; background-color:#fff; } #plDebug .panelContent table { clear:both; border:0; padding:0; margin:0; border-collapse:collapse; border-spacing:0; } #plDebug .panelContent table a { color:#000; padding:2px 4px; } #plDebug .panelContent table a:hover { background-color:#ffc; } #plDebug .panelContent table th { background-color:#333; font-weight:bold; color:#fff; padding:3px 7px 3px; text-align:left; cursor:pointer; } #plDebug .panelContent table td { padding:5px 10px; font-size:14px; background:#fff; color:#000; vertical-align:top; border:0; } #plDebug .panelContent table tr.plDebugOdd td { background:#eee; } */ #plDebug .panelContent .plDebugClose { text-indent:-9999999px; display:block; position:absolute; top:4px; right:15px; height:40px; width:40px; background:url(close.png) no-repeat center center; } #plDebug .panelContent .plDebugClose:hover { background-image:url(close_hover.png); } #plDebug .panelContent .plDebugClose.plDebugBack { background-image:url(back.png); } #plDebug .panelContent .plDebugClose.plDebugBack:hover { background-image:url(back_hover.png); } #plDebug .panelContent dt, #plDebug .panelContent dd { display:block; } #plDebug .panelContent dt { margin-top:0.75em; } #plDebug .panelContent dd { margin-left:10px; } #plDebug a.toggleTemplate { padding:4px; background-color:#bbb; -moz-border-radius:3px; -webkit-border-radius:3px; } #plDebug a.toggleTemplate:hover { padding:4px; background-color:#444; color:#ffe761; -moz-border-radius:3px; -webkit-border-radius:3px; } #plDebug a.plTemplateShowContext, #plDebug a.plTemplateShowContext span.toggleArrow { color:#999; } #plDebug a.plTemplateShowContext:hover, #plDebug a.plTemplateShowContext:hover span.toggleArrow { color:#000; cursor:pointer; } #plDebug .plDebugSqlWrap { position:relative; } #plDebug .plDebugSql { z-index:100000002; } #plDebug .plSQLHideStacktraceDiv tbody th { text-align: left; } #plDebug span.plDebugLineChart { border-top:3px solid #777; position:absolute; bottom:0; top:0; left:0; display:block; z-index:1000000001; } #plDebug span.plDebugLineChartWarning { border-top-color:#900; } #plDebug .highlight { color:#000; } #plDebug .highlight .err { color:#000; } /* Error */ #plDebug .highlight .g { color:#000; } /* Generic */ #plDebug .highlight .k { color:#000; font-weight:bold } /* Keyword */ #plDebug .highlight .o { color:#000; } /* Operator */ #plDebug .highlight .n { color:#000; } /* Name */ #plDebug .highlight .mi { color:#000; font-weight:bold } /* Literal.Number.Integer */ #plDebug .highlight .l { color:#000; } /* Literal */ #plDebug .highlight .x { color:#000; } /* Other */ #plDebug .highlight .p { color:#000; } /* Punctuation */ #plDebug .highlight .m { color:#000; font-weight:bold } /* Literal.Number */ #plDebug .highlight .s { color:#333 } /* Literal.String */ #plDebug .highlight .w { color:#888888 } /* Text.Whitespace */ #plDebug .highlight .il { color:#000; font-weight:bold } /* Literal.Number.Integer.Long */ #plDebug .highlight .na { color:#333 } /* Name.Attribute */ #plDebug .highlight .nt { color:#000; font-weight:bold } /* Name.Tag */ #plDebug .highlight .nv { color:#333 } /* Name.Variable */ #plDebug .highlight .s2 { color:#333 } /* Literal.String.Double */ #plDebug .highlight .cp { color:#333 } /* Comment.Preproc */ libplack-middleware-debug-perl-0.16+dfsg.orig/MANIFEST0000644000175000017500000000224112330540277020173 0ustar fsfsBuild.PL Changes INSTALL LICENSE MANIFEST META.json META.yml README README.mkdn cpanfile dist.ini examples/dbi/app.psgi examples/dbi/dump.sql examples/hello-world/app.psgi lib/Plack/Middleware/Debug.pm lib/Plack/Middleware/Debug/Base.pm lib/Plack/Middleware/Debug/CatalystLog.pm lib/Plack/Middleware/Debug/DBITrace.pm lib/Plack/Middleware/Debug/Environment.pm lib/Plack/Middleware/Debug/Memory.pm lib/Plack/Middleware/Debug/ModuleVersions.pm lib/Plack/Middleware/Debug/Panel.pm lib/Plack/Middleware/Debug/Parameters.pm lib/Plack/Middleware/Debug/PerlConfig.pm lib/Plack/Middleware/Debug/Response.pm lib/Plack/Middleware/Debug/Session.pm lib/Plack/Middleware/Debug/Timer.pm lib/Plack/Middleware/Debug/TrackObjects.pm share/debug_toolbar/back.png share/debug_toolbar/back_hover.png share/debug_toolbar/close.png share/debug_toolbar/close_hover.png share/debug_toolbar/indicator.png share/debug_toolbar/information.gif share/debug_toolbar/jquery.cookie.js share/debug_toolbar/panel_bg.png share/debug_toolbar/toolbar.css share/debug_toolbar/toolbar.js share/debug_toolbar/toolbar.min.css share/debug_toolbar/toolbar.min.js t/01_basic.t t/parameters-leak.t t/release-pod-syntax.t t/utf8.t libplack-middleware-debug-perl-0.16+dfsg.orig/lib/0000755000175000017500000000000012330540277017611 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/0000755000175000017500000000000012212420730020631 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/0000755000175000017500000000000012212420730022706 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/0000755000175000017500000000000012330540277023746 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/DBITrace.pm0000644000175000017500000000227412212420730025654 0ustar fsfspackage Plack::Middleware::Debug::DBITrace; use 5.008; use strict; use warnings; use Plack::Util::Accessor qw(level); use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub prepare_app { my $self = shift; $self->level(1) unless defined $self->level; } sub run { my($self, $env, $panel) = @_; $panel->nav_subtitle("Level " . $self->level); my($old_trace, $output); if (defined &DBI::trace) { $old_trace = DBI->trace; open my $fh, ">", \$output; DBI->trace($self->level . ",SQL", $fh); } else { return $panel->disable; } return sub { my $res = shift; if (defined $old_trace) { DBI->trace($old_trace); $panel->content($self->render_lines($output)); } }; } 1; __END__ =head1 NAME Plack::Middleware::Debug::DBITrace - DBI trace panel =head1 SYNOPSIS enable "Debug"; enable "Debug::DBITrace"; =head1 DESCRIPTION This debug panel captures DBI trace log in a raw format. See also L to see the profile log, which would be more useful. =head1 SEE ALSO L L =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Panel.pm0000644000175000017500000000034712212420730025335 0ustar fsfspackage Plack::Middleware::Debug::Panel; use strict; use warnings; use Plack::Util::Accessor qw(dom_id url title nav_title nav_subtitle content disabled); sub new { bless {}, shift } sub disable { $_[0]->disabled(1); return } 1; libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Timer.pm0000644000175000017500000000416012212420730025353 0ustar fsfspackage Plack::Middleware::Debug::Timer; use 5.008; use strict; use warnings; use Time::HiRes; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub run { my($self, $env, $panel) = @_; my $start = [ Time::HiRes::gettimeofday ]; return sub { my $res = shift; my $end = [ Time::HiRes::gettimeofday ]; my $elapsed = sprintf '%.6f s', Time::HiRes::tv_interval $start, $end; $panel->nav_subtitle($elapsed); $panel->content( $self->render_list_pairs( [ Start => $self->format_time($start), End => $self->format_time($end), Elapsed => $elapsed ], ), ); }; } sub format_time { my ($self, $time) = @_; my ($sec, $min, $hour, $mday, $mon, $year) = (localtime($time->[0])); sprintf "%04d.%02d.%02d %02d:%02d:%02d.%d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec, $time->[1]; } 1; __END__ =head1 NAME Plack::Middleware::Debug::Timer - Debug panel to time the request =head1 SYNOPSIS Plack::Middleware::Debug::Timer->new; =head1 DESCRIPTION =head1 METHODS =over 4 =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/ModuleVersions.pm0000644000175000017500000000310112212420730027243 0ustar fsfspackage Plack::Middleware::Debug::ModuleVersions; use 5.008; use strict; use warnings; use Module::Versions; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub run { my ($self, $env, $panel) = @_; my $modules = Module::Versions->HASH; $_ = $_->{VERSION} for values %$modules; $panel->content($self->render_hash($modules)); } 1; __END__ =head1 NAME Plack::Middleware::Debug::ModuleVersions - Debug panel to inspect versions of loaded modules =head1 SYNOPSIS Plack::Middleware::Debug::ModuleVersions->new; =head1 DESCRIPTION =head1 METHODS =over 4 =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Session.pm0000644000175000017500000000073612212420730025723 0ustar fsfspackage Plack::Middleware::Debug::Session; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); sub run { my ($self, $env, $panel) = @_; return sub { my $res = shift; my $session = $env->{'psgix.session'} or return $panel->disable; $panel->content($self->render_hash($session)); }; } 1; __END__ =head1 NAME =head1 AUTHOR Masahiro Chiba =head1 SEE ALSO L =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/CatalystLog.pm0000644000175000017500000000405012212420730026517 0ustar fsfspackage Plack::Middleware::Debug::CatalystLog; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); use Catalyst::Log; use Class::Method::Modifiers qw(install_modifier); our $VERSION = '0.16'; # XXX Not thread/Coro/AE safe. Should use $c->env or something my $psgi_env; install_modifier 'Catalyst::Log', 'around', '_log' => sub { my $orig = shift; my $self = shift; $psgi_env->{'plack.middleware.catalyst_log'} .= "[$_[0]] $_[1]\n"; $self->$orig(@_); }; sub run { my($self, $env, $panel) = @_; $psgi_env = $env; return sub { my $res = shift; my $log = delete $env->{'plack.middleware.catalyst_log'} || 'No Log'; $panel->content("
$log
"); $psgi_env = undef; }; } 1; __END__ =head1 NAME Plack::Middleware::Debug::Environment - Debug panel to inspect the environment =head1 SYNOPSIS builder { enable "Debug"; enable "Debug::CatalystLog"; sub { MyApp->run(@_) }; }; =head1 DESCRIPTION This debug panel captures the logging output from Catalyst applications. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Environment.pm0000644000175000017500000000271712212420730026605 0ustar fsfspackage Plack::Middleware::Debug::Environment; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub run { my($self, $env, $panel) = @_; $panel->content(sub { $self->render_hash($env) }); return; } 1; __END__ =head1 NAME Plack::Middleware::Debug::Environment - Debug panel to inspect the environment =head1 SYNOPSIS Plack::Middleware::Debug::Environment->new; =head1 DESCRIPTION =head1 METHODS =over 4 =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/PerlConfig.pm0000644000175000017500000000272112212420730026324 0ustar fsfspackage Plack::Middleware::Debug::PerlConfig; use 5.008; use strict; use warnings; use Config; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub run { my ($self, $env, $panel) = @_; $panel->content($self->render_hash(\%Config)); } 1; __END__ =head1 NAME Plack::Middleware::Debug::PerlConfig - Debug panel for Perl configuration information =head1 SYNOPSIS Plack::Middleware::Debug::PerlConfig->new; =head1 DESCRIPTION =head1 METHODS =over 4 =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/TrackObjects.pm0000644000175000017500000000267012212420730026655 0ustar fsfspackage Plack::Middleware::Debug::TrackObjects; use strict; use parent qw(Plack::Middleware::Debug::Base); sub run { my($self, $env, $panel) = @_; unless ($INC{"Devel/TrackObjects.pm"}) { return $panel->disable; } return sub { my $res = shift; my $track = Devel::TrackObjects->show_tracked_detailed; my @content; foreach (@$track){ if (length($_->[0]) > 100){ $_->[0] = substr($_->[0],0,100); } push @content, $_->[0], $_->[1].' - '.$_->[2]; } $panel->nav_subtitle('Number:'.scalar(@content)/2); $panel->content( $self->render_list_pairs([@content]) ); }; } 1; __END__ =head1 NAME Plack::Middleware::Debug::TrackObjects - Track Objects panel =head1 SYNOPSIS enable "Debug"; enable "Debug::TrackObjects"; And when you load the application with plackup or other launcher: # track everything plackup -MDevel::TrackObjects=/^/ myapp.psgi You can specify the namespace with a regular expression. See L for details. =head1 DESCRIPTION This debug panel captures objects created in a request cycle by using L. You can run your applications multiple times (i.e. refreshing the page) to see if the count of tracked objects increases, in which case there are leaked objects. =head1 SEE ALSO L L =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Response.pm0000644000175000017500000000324412212420730026073 0ustar fsfspackage Plack::Middleware::Debug::Response; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub run { my($self, $env, $panel) = @_; return sub { my $res = shift; my @headers; Plack::Util::header_iter($res->[1], sub { push @headers, @_ }); $panel->content( $self->render_list_pairs( [ 'Status code' => $res->[0], @headers ], ), ); }; } 1; __END__ =head1 NAME Plack::Middleware::Debug::Response - Debug panel to inspect the response =head1 SYNOPSIS Plack::Middleware::Debug::Response->new; =head1 DESCRIPTION =head1 METHODS =over 4 =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Base.pm0000644000175000017500000001354512212420730025154 0ustar fsfspackage Plack::Middleware::Debug::Base; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware); use Plack::Util::Accessor qw(renderer); use Text::MicroTemplate; use Data::Dump; use Scalar::Util; our $VERSION = '0.16'; sub call { my($self, $env) = @_; my $panel = $self->default_panel; my $after = $self->run($env, $panel); $self->response_cb($self->app->($env), sub { my $res = shift; $after->($res) if $after && ref $after eq 'CODE'; push @{$env->{'plack.debug.panels'}}, $panel; }); } sub run { } sub panel_id { my $self = shift; (my $name = ref $self) =~ s/.*:://; $name . Scalar::Util::refaddr($self); } sub panel_name { my $self = shift; (my $name = ref $self) =~ s/.*:://; $name =~ s/(?<=[a-z])(?=[A-Z])/ /g; $name; } sub default_panel { my($self, $env) = @_; my $id = $self->panel_id; my $name = $self->panel_name; my $panel = Plack::Middleware::Debug::Panel->new; $panel->dom_id("plDebug${id}Panel"); $panel->url('#'); $panel->title($name); $panel->nav_title($name); $panel->nav_subtitle(''); $panel->content(''); $panel; } sub vardump { my $scalar = shift; return '(undef)' unless defined $scalar; return "$scalar" unless ref $scalar; scalar Data::Dump::dump($scalar); } sub build_template { my $class = shift; Text::MicroTemplate->new( template => $_[0], tag_start => '<%', tag_end => '%>', line_start => '%', )->build; } sub render { my ($self, $template, $vars) = @_; $template->($vars); } my $list_section_template = __PACKAGE__->build_template(<<'EOTMPL'); % foreach my $s (@{$_[0]->{sections}}) {

<%= ucfirst $s %>

% if (scalar @{$_[0]->{list}->{$s}}) { % my $i; % while (@{$_[0]->{list}->{$s}}) { % my($key, $value) = splice(@{$_[0]->{list}->{$s}}, 0, 2); % }
Key Value
<%= $key %> <%= vardump($value) %>
% } % } EOTMPL my $list_template = __PACKAGE__->build_template(<<'EOTMPL'); % my $i; % while (@{$_[0]->{list}}) { % my($key, $value) = splice(@{$_[0]->{list}}, 0, 2); % }
Key Value
<%= $key %> <%= vardump($value) %>
EOTMPL my $line_template = __PACKAGE__->build_template(<<'EOTMPL'); % my $i; % if (defined $_[0]->{lines}) { % my @lines = ref $_[0]->{lines} eq 'ARRAY' ? @{$_[0]->{lines}} : split /\r?\n/, $_[0]->{lines}; % for my $line (@lines) { % } % }
<%= $line %>
EOTMPL sub render_lines { my ($self, $lines) = @_; $self->render($line_template, { lines => $lines }); } sub render_list_pairs { my ($self, $list, $sections) = @_; if ($sections) { $self->render($list_section_template, { list => $list, sections => $sections }); }else{ $self->render($list_template, { list => $list }); } } sub render_hash { my ( $self, $hash, $sections ) = @_; if ($sections) { my %hash; foreach my $section ( keys %$hash ) { push @{ $hash{$section} }, map { $_ => $hash->{$section}->{$_} } sort keys %{ $hash->{$section} }; } $self->render( $list_section_template, { sections => $sections, list => \%hash } ); } else { my @hash = map { $_ => $hash->{$_} } sort keys %$hash; $self->render( $list_template, { list => \@hash } ); } } 1; __END__ =head1 NAME Plack::Middleware::Debug::Base - Base class for Debug panels =head1 SYNOPSIS package Plack::Middleware::Debug::YourPanel; use parent qw(Plack::Middleware::Debug::Base); sub run { my($self, $env, $panel) = @_; # Do something before the application runs return sub { my $res = shift; # Do something after the application returns }; } =head1 DESCRIPTION This is the base class for panels. =head1 METHODS =over 4 =item C This method is called when a request has arrived, before the main application runs. The parameters are C<$env>, the PSGI environment hash reference and C<$panel>, a Plack::Middleware::Debug::Panel object. If your panel needs to do some response munging, you should return a callback that takes C<$res> the response object. Because you can return a closure, the response filter can also use C<$env> and C<$panel> easily. =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel GrEnauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Parameters.pm0000644000175000017500000000251212212420730026375 0ustar fsfspackage Plack::Middleware::Debug::Parameters; use strict; use warnings; use Plack::Util::Accessor qw(elements); use parent qw/Plack::Middleware::Debug::Base/; use Plack::Request; sub prepare_app { my $self = shift; $self->elements( [qw/headers cookies get post session/] ) unless $self->elements; } sub run { my ( $self, $env, $panel ) = @_; return sub { my $parameters; my $request = Plack::Request->new($env); $parameters = { get => $request->query_parameters, cookies => $request->cookies, post => $request->body_parameters, session => $env->{'psgix.session'}, headers => $request->headers, }; $panel->title('Request Variables'); $panel->nav_title('Request Variables'); $panel->content($self->render_hash( $parameters, $self->elements )); } } 1; __END__ =head1 NAME Plack::Middleware::Debug::Parameters - Parameters Panel =head1 SYNOPSIS builder { enable 'Debug'; # load defaults enable 'Debug::Parameters', elements => [qw/headers cookies/]; $app; }; =head1 DESCRIPTION return info about: =over 4 =item request headers =item query parameters =item body parameters =item cookies =item session =back =head1 SEE ALSO L =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug/Memory.pm0000644000175000017500000000203212212420730025537 0ustar fsfspackage Plack::Middleware::Debug::Memory; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.16'; sub run { my($self, $env, $panel) = @_; my $before = $self->current_memory; return sub { my $res = shift; my $after = $self->current_memory; $panel->nav_subtitle($self->format_memory($after)); $panel->content( $self->render_list_pairs( [ Before => $self->format_memory($before), After => $self->format_memory($after), Diff => $self->format_memory($after - $before) ], ), ); }; } sub format_memory { my ($self, $memory) = @_; 1 while $memory =~ s/^([-+]?\d+)(\d{3})/$1,$2/; return "$memory KB"; } sub current_memory { my $self = shift; my $out = `ps -o rss= -p $$`; $out =~ s/^\s*|\s*$//gs; $out; } 1; __END__ =head1 NAME Plack::Middleware::Debug::Memory - Memory Panel =head1 SEE ALSO L =cut libplack-middleware-debug-perl-0.16+dfsg.orig/lib/Plack/Middleware/Debug.pm0000644000175000017500000002575212212420730024305 0ustar fsfspackage Plack::Middleware::Debug; use 5.008_001; use strict; use warnings; use parent qw(Plack::Middleware); our $VERSION = '0.16'; use Encode; use File::ShareDir; use Plack::App::File; use Plack::Builder; use Plack::Util::Accessor qw(panels renderer files); use Plack::Util; use Plack::Middleware::Debug::Panel; use Text::MicroTemplate; use Try::Tiny; sub TEMPLATE { <<'EOTMPL' } % my $stash = $_[0];
% for my $panel (reverse @{$stash->{panels}}) { % if ($panel->content) {
Close

<%= $panel->title %>

% my $content = ref $panel->content eq 'CODE' ? $panel->content->() : $panel->content; % $content = Encode::encode('latin1', $content, Encode::FB_XMLCREF); <%= Text::MicroTemplate::encoded_string($content) %>
% } % } # end for
EOTMPL sub default_panels { [qw(Environment Response Timer Memory Session DBITrace)]; } sub prepare_app { my $self = shift; my $root = try { File::ShareDir::dist_dir('Plack-Middleware-Debug') } || 'share'; my $builder = Plack::Builder->new; for my $spec (@{ $self->panels || $self->default_panels }) { my ($package, %args); if (ref $spec eq 'ARRAY') { # For the backward compatiblity # [ 'PanelName', key1 => $value1, ... ] $package = shift @$spec; $builder->add_middleware("Debug::$package", @$spec); } else { # $spec could be a code ref (middleware) or a string # copy so that we do not change default_panels my $spec_copy = $spec; $spec_copy = "Debug::$spec_copy" unless ref $spec_copy; $builder->add_middleware($spec_copy); } } $self->app( $builder->to_app($self->app) ); $self->renderer( Text::MicroTemplate->new( template => $self->TEMPLATE, tag_start => '<%', tag_end => '%>', line_start => '%', )->build ); $self->files(Plack::App::File->new(root => $root)); } sub call { my ($self, $env) = @_; if ($env->{PATH_INFO} =~ m!^/debug_toolbar!) { return $self->files->call($env); } $env->{'plack.debug.panels'} = []; my $res = $self->app->($env); $self->response_cb($res, sub { my $res = shift; my $headers = Plack::Util::headers($res->[1]); my $panels = delete $env->{'plack.debug.panels'}; if ( ! Plack::Util::status_with_no_entity_body($res->[0]) && ($headers->get('Content-Type') || '') =~ m!^(?:text/html|application/xhtml\+xml)!) { my $vars = { panels => [ grep !$_->disabled, @$panels ], BASE_URL => $env->{SCRIPT_NAME}, }; my $content = $self->renderer->($vars); return sub { my $chunk = shift; return unless defined $chunk; $chunk =~ s!(?=)!$content!i; return $chunk; }; } }); } 1; __END__ =head1 NAME Plack::Middleware::Debug - display information about the current request/response =head1 SYNOPSIS enable "Debug"; =head1 DESCRIPTION The debug middleware offers a configurable set of panels that displays information about the current request and response. The information is generated only for responses with a status of 200 (C) and a C that contains C or C and is embedded in the HTML that is sent back to the browser. Also the code is injected directly before the C<< >> tag so if there is no such tag, the information will not be injected. To enable the middleware, just use L as usual in your C<.psgi> file: use Plack::Builder; builder { enable 'Debug', panels => [ qw(DBITrace Memory Timer) ]; $app; }; The C middleware takes an optional C argument whose value is expected to be a reference to an array of panel specifications. If given, only those panels will be enabled. If you don't pass a C argument, the default list of panels - C, C, C, C, C and C - will be enabled, each with their default settings, and automatically disabled if their targer modules or middleware components are not loaded. Each panel specification can take one of three forms: =over 4 =item A string This is interpreted as the base name of a panel in the C namespace. The panel class is loaded and a panel object is created with its default settings. =item An array reference If you need to pass arguments to the panel object as it is created, you may use this form (But see below). The first element of the array reference has to be the panel base name. The remaining elements are key/value pairs to be passed to the panel. For example: builder { enable 'Debug', panels => [ qw(Environment Response Timer Memory), [ 'DBITrace', level => 2 ] ]; $app; }; Because each panel is a middleware component, you can write this way as well: builder { enable 'Debug'; # load defaults enable 'Debug::DBITrace', level => 2; $app; }; Note that the C<> line should come before other Debug panels because of the order middleware components are executed. =item Custom middleware You can also pass a Panel middleware component. This might be useful if you have custom debug panels in your framework or web application. =back =head1 HOW TO WRITE YOUR OWN DEBUG PANEL The C middleware is designed to be easily extensible. You might want to write a custom debug panel for your framework or for your web application. Each debug panel is also a Plack middleware copmonent and is easy to write one. Let's look at the anatomy of the C debug panel. Here is the code from that panel: package Plack::Middleware::Debug::Timer; use Time::HiRes; use parent qw(Plack::Middleware::Debug::Base); sub run { my($self, $env, $panel) = @_; my $start = [ Time::HiRes::gettimeofday ]; return sub { my $res = shift; my $end = [ Time::HiRes::gettimeofday ]; my $elapsed = sprintf '%.6f s', Time::HiRes::tv_interval $start, $end; $panel->nav_subtitle($elapsed); $panel->content( $self->render_list_pairs( [ Start => $self->format_time($start), End => $self->format_time($end), Elapsed => $elapsed ], ), ); }; } sub format_time { ... } To write a new debug panel, place it in the C namespace. In our example, the C panel lives in the C package. The only thing your panel should do is to subclass L. This does most of the things a middleware component should do as a Plack middleware, so you only need to override C method to profile and create the panel content. sub run { my($self, $env, $panel) = @_; # Do something before the application runs return sub { my $res = shift; # Do something after the application returns }; } You can create as many lexical variables as you need and reference that in the returned callback as a closure, and update the content of of the C<$panel> which is Plack::Middleware::Debug::Panel object. In our C example we want to list three key/value pairs: the start time, the end time and the elapsed time. We use the C method to place the pairs in the order we want. There is also a C and C method, to render a hash keys and values, as well as just text lines (e.g. log messages). =head1 BUGS AND LIMITATIONS Please report any bugs or feature requests through the web interface at L. =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you. Or see L. The development version lives at L. Instead of sending patches, please fork this project using the standard git and github infrastructure. =head1 AUTHORS Marcel Grunauer, C<< >> Tatsuhiko Miyagawa, C<< >> =head1 COPYRIGHT AND LICENSE Copyright 2009 by Marcel GrEnauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO The debug middleware is heavily influenced (that is, adapted from) the Django Debug Toolbar - see L. =cut libplack-middleware-debug-perl-0.16+dfsg.orig/LICENSE0000644000175000017500000004400212212420730020036 0ustar fsfsThis software is copyright (c) 2009 by Marcel Grunauer, C<< >>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2009 by Marcel Grunauer, C<< >>. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2009 by Marcel Grunauer, C<< >>. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End libplack-middleware-debug-perl-0.16+dfsg.orig/INSTALL0000644000175000017500000000110512212420730020057 0ustar fsfsThis is the Perl distribution Plack-Middleware-Debug. ## Installation Plack-Middleware-Debug installation is straightforward. If your CPAN shell is set up, you should just be able to do % cpan Plack::Middleware::Debug Download it, unpack it, then build it as per the usual: % perl Makefile.PL % make && make test Then install it: % make install ## Documentation Plack-Middleware-Debug documentation is available as in POD. So you can do: % perldoc Plack::Middleware::Debug to read the documentation online with your favorite pager. Marcel Gruenauer libplack-middleware-debug-perl-0.16+dfsg.orig/README.mkdn0000644000175000017500000002164612212420730020652 0ustar fsfs# NAME Plack::Middleware::Debug - display information about the current request/response # SYNOPSIS # app.psgi use Plack::Builder; my $app = sub { return [ 200, [ 'Content-Type' => 'text/html' ], [ 'Hello World' ] ]; }; builder { enable 'Debug'; $app; }; # DESCRIPTION The debug middleware offers a configurable set of panels that displays information about the current request and response. The information is generated only for responses with a status of 200 (`OK`) and a `Content-Type` that contains `text/html` and is embedded in the HTML that is sent back to the browser. Also the code is injected directly before the `` tag so if there is no such tag, the information will not be injected. To enable the middleware, just use [Plack::Builder](http://search.cpan.org/perldoc?Plack::Builder) as usual in your `.psgi` file: use Plack::Builder; builder { enable 'Debug', panels => [ qw(DBITrace PerlConfig) ]; $app; }; The `Debug` middleware takes an optional `panels` argument whose value is expected to be a reference to an array of panel specifications. If given, only those panels will be enabled. If you don't pass a `panels` argument, the default list of panels - `Environment`, `Response`, `Timer` and `Memory` - will be enabled, each with their default settings. Each panel specification can take one of three forms: - A string This is interpreted as the base name of a panel in the `Plack::Middeware::Debug::` namespace. The panel class is loaded and a panel object is created with its default settings. - An array reference If you need to pass arguments to the panel object as it is created, use this form. The first element of the array reference has to be the panel base name. The remaining elements are key/value pairs to be passed to the panel. Not all panels take extra arguments. But the `DBITrace` panel, for example, takes an optional `level` argument to specify the desired trace level. For example: builder { enable 'Debug', panels => [ qw(Environment Response Timer Memory), [ 'DBITrace', level => 2 ] ]; $app; }; - An object You can also pass panel objects directly to the `Debug` middleware. This might be useful if you have custom debug panels in your framework or web application. # PANELS - `DBITrace` Display DBI trace information. See [Plack::Middleware::Debug::DBITrace](http://search.cpan.org/perldoc?Plack::Middleware::Debug::DBITrace). - `Environment` Displays the PSGI environment from the request. See [Plack::Middleware::Debug::Environment](http://search.cpan.org/perldoc?Plack::Middleware::Debug::Environment). - `Memory` Displays memory usage before the request and after the response. See [Plack::Middleware::Debug::Memory](http://search.cpan.org/perldoc?Plack::Middleware::Debug::Memory). - `ModuleVersions` Displays the loaded modules and their versions. See [Plack::Middleware::Debug::ModuleVersions](http://search.cpan.org/perldoc?Plack::Middleware::Debug::ModuleVersions). - `PerlConfig` Displays the configuration information of the Perl interpreter itself. See [Plack::Middleware::Debug::PerlConfig](http://search.cpan.org/perldoc?Plack::Middleware::Debug::PerlConfig) - `Response` Displays the status code and response headers. See [Plack::Middleware::Debug::Response](http://search.cpan.org/perldoc?Plack::Middleware::Debug::Response). - `Timer` Displays how long the request took. See [Plack::Middleware::Debug::Timer](http://search.cpan.org/perldoc?Plack::Middleware::Debug::Timer). - `CatalystLog` In a Catalyst application, this panel displays the Catalyst log output. See [Plack::Middleware::Debug::CatalystLog](http://search.cpan.org/perldoc?Plack::Middleware::Debug::CatalystLog). # HOW TO WRITE YOUR OWN DEBUG PANEL The `Debug` middleware is designed to be easily extensible. You might want to write a custom debug panel for your framework or for your web application. Let's look at the anatomy of the `Timer` debug panel. Here is the code from that panel: package Plack::Middleware::Debug::Timer; use 5.008; use strict; use warnings; use Time::HiRes qw(gettimeofday tv_interval); use Plack::Util::Accessor qw(start_time elapsed); use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.03'; sub nav_subtitle { my $self = shift; $self->format_elapsed; } sub format_elapsed { my $self = shift; sprintf '%s s', $self->elapsed; } sub format_time { my ($self, $time) = @_; my ($sec, $min, $hour, $mday, $mon, $year) = (localtime($time->[0])); sprintf "%04d.%02d.%02d %02d:%02d:%02d.%d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec, $time->[1]; } sub process_request { my ($self, $env) = @_; $self->start_time([gettimeofday]); } sub process_response { my ($self, $res, $env) = @_; my $end_time = [gettimeofday]; $self->elapsed(tv_interval $self->start_time, $end_time); $self->content( $self->render_list_pairs( [ Start => $self->format_time($self->start_time), End => $self->format_time($end_time), Elapsed => $self->format_elapsed, ] ) ); } To write a new debug panel, place it in the `Plack::Middleware::Debug::` namespace. In our example, the `Timer` panel lives in the `Plack::Middleware::Debug::Timer` package. A panel should subclass [Plack::Middleware::Debug::Base](http://search.cpan.org/perldoc?Plack::Middleware::Debug::Base). It provides a lot of methods that the `Debug` middleware expects a panel to have and provides some sensible defaults for others, so you only need to override what is specific to your custom panel. The panels' title - which appears at the top left when the panel is active - and its navigation title - which appears in the navigation bar on the right side - are set automatically from the panel's base name - `Timer` in our case. This is a useful for default for us, so we don't need to override these methods. The panels' navigation subtitle, which appears in the navigation bar underneath the panel title in smaller letters, is empty by default. For the `Timer` panel, we would like to show the total time elapsed so the user can get the quick overview without having to activate the panel. So we override the `nav_subtitle()` method. How do we know how much time elapsed for the request? We have to take the time when the request comes in, and again when the response goes out. So we override the `process_request()` and `process_response()` methods. In `process_request()` we just store the current time. To generate the accessors for any attributes our panel might need we use [Plack::Util::Accessor](http://search.cpan.org/perldoc?Plack::Util::Accessor). In `process_response()` we take the time again, determine how much time has elapsed, store that information in an accessor so `sub_navtitle()` can return it when asked by the template, then we actually render the template with our data and store it in `content()`. When the HTML, CSS and JavaScript are generated and injected by the `Debug` middleware, it will ask all panels whether they have any content. If so, the actual panel is generated. If not, then just an inactive navigation bar entry is generated. Having data in the panel's `content` attribute is the sign that the `Debug` middleware looks for. In our `Timer` example we want to list three key/value pairs: the start time, the end time and the elapsed time. We use the `render_list_pairs()` method to place the pairs in the order we want. There is also a `render_hash()` method, but it would sort the hash keys, and this is not what we want. With this our `Timer` debug panel is finished. Now we can use it in the `enable 'Debug'` call like any other debug panel. # BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at . # INSTALLATION See perlmodinstall for information and options on installing Perl modules. # AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit to find a CPAN site near you. Or see . The development version lives at . Instead of sending patches, please fork this project using the standard git and github infrastructure. # AUTHORS Marcel Grünauer, `` Tatsuhiko Miyagawa, `` # COPYRIGHT AND LICENSE Copyright 2009 by Marcel Grünauer This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. # SEE ALSO The debug middleware is heavily influenced (that is, adapted from) the Django Debug Toolbar - see .libplack-middleware-debug-perl-0.16+dfsg.orig/t/0000755000175000017500000000000012212420730017274 5ustar fsfslibplack-middleware-debug-perl-0.16+dfsg.orig/t/01_basic.t0000755000175000017500000000155112212420730021047 0ustar fsfs#!/usr/bin/env perl use warnings; use strict; use Plack::Test; use Plack::Builder; use HTTP::Request::Common; use Test::More; my @content_types = ('text/html', 'text/html; charset=utf8',); for my $content_type (@content_types) { note "Content-Type: $content_type"; my $app = sub { return [ 200, [ 'Content-Type' => $content_type ], ['Hello World'] ]; }; $app = builder { enable 'Debug'; $app; }; test_psgi $app, sub { my $cb = shift; my $res = $cb->(GET '/'); is $res->code, 200, 'response status 200'; for my $panel (qw(Environment Response Timer Memory)) { like $res->content, qr//, "HTML contains $panel panel"; } }; } done_testing; libplack-middleware-debug-perl-0.16+dfsg.orig/t/release-pod-syntax.t0000644000175000017500000000045012212420730023204 0ustar fsfs#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); libplack-middleware-debug-perl-0.16+dfsg.orig/t/parameters-leak.t0000644000175000017500000000126012212420730022535 0ustar fsfsuse strict; use warnings FATAL => 'all'; use Test::Requires qw(Test::LeakTrace); use Plack::Test; use Plack::Builder; use HTTP::Request::Common qw(GET); use Test::More; ok ( my $app = sub { return [ 200, [ 'Content-Type' => 'text/html' ], ['Hello World'] ]; }, 'Created an application to test', ); ok ( $app = builder { enable 'Debug', panels => ['Parameters']; $app; }, 'Enabled the "Parameters" panel', ); ok ( my $cb = sub { shift->(GET '/'); }, 'Created callback function for test_psgi', ); no_leaks_ok ( sub { for (1..5) { test_psgi $app, $cb; } }, 'No leaks in application', ); done_testing; libplack-middleware-debug-perl-0.16+dfsg.orig/t/utf8.t0000644000175000017500000000121712212420730020350 0ustar fsfsuse warnings; use strict; use Encode; use Plack::Test; use Plack::Middleware::Debug; use HTTP::Request::Common; use Test::More; my $app = sub { my $env = shift; $env->{'test.string'} = "\x{30c6}"; return [ 200, [ 'Content-Type' => 'text/html' ], [ encode_utf8("

\x{30c6}\x{30b9}\x{30c8}

") ] ]; }; $app = Plack::Middleware::Debug->wrap($app); test_psgi $app, sub { my $cb = shift; my $res = $cb->(GET '/'); is $res->code, 200, 'response status 200'; like $res->content, qr!

テスト

!; like $res->content, qr!test.string\s*テ!s; }; done_testing; libplack-middleware-debug-perl-0.16+dfsg.orig/dist.ini0000644000175000017500000000001112212420730020465 0ustar fsfs[@Milla] libplack-middleware-debug-perl-0.16+dfsg.orig/cpanfile0000644000175000017500000000044412212420730020537 0ustar fsfsrequires 'Class::Method::Modifiers', '1.05'; requires 'Data::Dump'; requires 'Encode', '2.23'; requires 'File::ShareDir', '1.00'; requires 'Plack'; requires 'Text::MicroTemplate', '0.15'; requires 'parent'; requires 'perl', '5.008001'; on test => sub { requires 'Test::More', '0.70'; }; libplack-middleware-debug-perl-0.16+dfsg.orig/META.json0000644000175000017500000000425012212420730020453 0ustar fsfs{ "abstract" : "display information about the current request/response", "author" : [ "Marcel Grunauer, C<< >>" ], "dynamic_config" : 0, "generated_by" : "Dist::Milla version v1.0.4, Dist::Zilla version 4.300037, CPAN::Meta::Converter version 2.132140", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Plack-Middleware-Debug", "no_index" : { "directory" : [ "t", "xt", "inc", "share", "eg", "examples" ] }, "prereqs" : { "configure" : { "requires" : { "Module::Build::Tiny" : "0.026" } }, "develop" : { "requires" : { "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Class::Method::Modifiers" : "1.05", "Data::Dump" : "0", "Encode" : "2.23", "File::ShareDir" : "1.00", "Plack" : "0", "Text::MicroTemplate" : "0.15", "parent" : "0", "perl" : "5.008001" } }, "test" : { "requires" : { "Test::More" : "0.70" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/miyagawa/Plack-Middleware-Debug/issues" }, "homepage" : "https://github.com/miyagawa/Plack-Middleware-Debug", "repository" : { "type" : "git", "url" : "https://github.com/miyagawa/Plack-Middleware-Debug.git", "web" : "https://github.com/miyagawa/Plack-Middleware-Debug" } }, "version" : "0.16", "x_contributors" : [ "Andreas Marienborg ", "Chisel ", "Graham Knop ", "John Napiorkowski ", "Jonathan Swartz ", "Marcel Gruenauer ", "Olaf Alders ", "Tatsuhiko Miyagawa ", "franck cuny " ] }