Plack-Middleware-Debug-0.17/000755 000765 000024 00000000000 13243360176 016541 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/Build.PL000644 000765 000024 00000000274 13243360176 020040 0ustar00miyagawastaff000000 000000 # This Build.PL for Plack-Middleware-Debug was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.015. use strict; use warnings; use 5.008001; use Module::Build::Tiny 0.034; Build_PL(); Plack-Middleware-Debug-0.17/Changes000644 000765 000024 00000006023 13243360176 020035 0ustar00miyagawastaff000000 000000 Revision history for Perl extension Plack-Middleware-Debug 0.17 2018-02-22 06:11:23 JST - Added support for loading debug middleware outside of the Plack::Middleware::Debug::* namespace, by prefixing the name of middleware with a "+", e.g. "+My::Plack::Middleware::Debug::Something". - Debug.pm no longer injects inline JavaScript 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 Plack-Middleware-Debug-0.17/cpanfile000644 000765 000024 00000000555 13243360176 020252 0ustar00miyagawastaff000000 000000 requires 'Class::Method::Modifiers', '1.05'; requires 'Data::Dump'; requires 'Data::Dumper::Concise'; 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'; requires 'Test::Requires', '0.08'; }; Plack-Middleware-Debug-0.17/dist.ini000644 000765 000024 00000000011 13243360176 020175 0ustar00miyagawastaff000000 000000 [@Milla] Plack-Middleware-Debug-0.17/examples/000755 000765 000024 00000000000 13243360176 020357 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/INSTALL000644 000765 000024 00000001105 13243360176 017567 0ustar00miyagawastaff000000 000000 This 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 Plack-Middleware-Debug-0.17/lib/000755 000765 000024 00000000000 13243360176 017307 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/LICENSE000644 000765 000024 00000044004 13243360176 017550 0ustar00miyagawastaff000000 000000 This 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, Fifth Floor, Boston, MA 02110-1301 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 Plack-Middleware-Debug-0.17/MANIFEST000644 000765 000024 00000002464 13243360176 017700 0ustar00miyagawastaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.009. Build.PL Changes INSTALL LICENSE MANIFEST META.json META.yml README 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/jquery.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/PlackX-Midldeware-Debug/MiddlewareDebugTest.pm t/author-pod-syntax.t t/parameters-leak.t t/utf8.t Plack-Middleware-Debug-0.17/META.json000644 000765 000024 00000005347 13243360176 020173 0ustar00miyagawastaff000000 000000 { "abstract" : "display information about the current request/response", "author" : [ "Marcel Grunauer, C<< >>" ], "dynamic_config" : 0, "generated_by" : "Dist::Milla version v1.0.18, Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Plack-Middleware-Debug", "no_index" : { "directory" : [ "eg", "examples", "inc", "share", "t", "xt" ] }, "prereqs" : { "configure" : { "requires" : { "Module::Build::Tiny" : "0.034" }, "suggests" : { "JSON::PP" : "2.27300" } }, "develop" : { "requires" : { "Dist::Milla" : "v1.0.18", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Class::Method::Modifiers" : "1.05", "Data::Dump" : "0", "Data::Dumper::Concise" : "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", "Test::Requires" : "0.08" } } }, "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.17", "x_contributors" : [ "\u00c6var Arnfj\u00f6r\u00f0 Bjarmason ", "Andreas Marienborg ", "Chisel ", "David Steinbrunner ", "Eugen Konkov ", "franck cuny ", "Graham Knop ", "John Napiorkowski ", "John SJ Anderson ", "Jonathan Swartz ", "Marcel Gruenauer ", "M Somerville ", "Olaf Alders ", "Tatsuhiko Miyagawa ", "Tatsuhiko Miyagawa " ], "x_serialization_backend" : "Cpanel::JSON::XS version 3.0233" } Plack-Middleware-Debug-0.17/META.yml000644 000765 000024 00000003364 13243360176 020020 0ustar00miyagawastaff000000 000000 --- abstract: 'display information about the current request/response' author: - 'Marcel Grunauer, C<< >>' build_requires: Test::More: '0.70' Test::Requires: '0.08' configure_requires: Module::Build::Tiny: '0.034' dynamic_config: 0 generated_by: 'Dist::Milla version v1.0.18, Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010' 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: - eg - examples - inc - share - t - xt requires: Class::Method::Modifiers: '1.05' Data::Dump: '0' Data::Dumper::Concise: '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.17' x_contributors: - 'Ævar Arnfjörð Bjarmason ' - 'Andreas Marienborg ' - 'Chisel ' - 'David Steinbrunner ' - 'Eugen Konkov ' - 'franck cuny ' - 'Graham Knop ' - 'John Napiorkowski ' - 'John SJ Anderson ' - 'Jonathan Swartz ' - 'Marcel Gruenauer ' - 'M Somerville ' - 'Olaf Alders ' - 'Tatsuhiko Miyagawa ' - 'Tatsuhiko Miyagawa ' x_serialization_backend: 'YAML::Tiny version 1.70' Plack-Middleware-Debug-0.17/README000644 000765 000024 00000014627 13243360176 017433 0ustar00miyagawastaff000000 000000 NAME 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. Note that the code is injected directly before the closing tag () so if there is no such tag, the debug panel will not be injected at all. 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 target 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, unless preceded by +, in which case it's interpreted as an absolute name similar to how Plack::Builder handles such names, e.g. +My::Plack::Middleware::Debug::Something. 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 component 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 http://rt.cpan.org. 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 http://www.perl.com/CPAN/ to find a CPAN site near you. Or see http://search.cpan.org/dist/Plack-Middleware-Debug/. The development version lives at http://github.com/miyagawa/plack-middleware-debug/. 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 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 http://github.com/robhudson/django-debug-toolbar. Plack-Middleware-Debug-0.17/share/000755 000765 000024 00000000000 13243360176 017643 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/t/000755 000765 000024 00000000000 13243360176 017004 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/t/01_basic.t000755 000765 000024 00000001747 13243360176 020566 0ustar00miyagawastaff000000 000000 #!/usr/bin/env perl use warnings; use strict; use Plack::Test; use Plack::Builder; use HTTP::Request::Common; use Test::More; use lib "t/PlackX-Midldeware-Debug"; 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', panels => [qw(Environment Response Timer Memory Session DBITrace +MiddlewareDebugTest)]; $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; Plack-Middleware-Debug-0.17/t/author-pod-syntax.t000644 000765 000024 00000000454 13243360176 022602 0ustar00miyagawastaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Plack-Middleware-Debug-0.17/t/parameters-leak.t000644 000765 000024 00000001260 13243360176 022245 0ustar00miyagawastaff000000 000000 use 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; Plack-Middleware-Debug-0.17/t/PlackX-Midldeware-Debug/000755 000765 000024 00000000000 13243360176 023265 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/t/utf8.t000644 000765 000024 00000001232 13243360176 020055 0ustar00miyagawastaff000000 000000 use 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; Plack-Middleware-Debug-0.17/t/PlackX-Midldeware-Debug/MiddlewareDebugTest.pm000644 000765 000024 00000000404 13243360176 027505 0ustar00miyagawastaff000000 000000 package MiddlewareDebugTest; 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; $panel->content( "Hello, world!" ); }; } 1; Plack-Middleware-Debug-0.17/share/debug_toolbar/000755 000765 000024 00000000000 13243360176 022453 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/share/debug_toolbar/back.png000644 000765 000024 00000002017 13243360176 024061 0ustar00miyagawastaff000000 000000 PNG  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`Plack-Middleware-Debug-0.17/share/debug_toolbar/back_hover.png000644 000765 000024 00000002006 13243360176 025262 0ustar00miyagawastaff000000 000000 PNG  IHDR"":G tEXtSoftwareAdobe ImageReadyqe<IDATxX]HQ>tKk%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`Plack-Middleware-Debug-0.17/share/debug_toolbar/close.png000644 000765 000024 00000002025 13243360176 024265 0ustar00miyagawastaff000000 000000 PNG  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!}Vn4cٗ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`Plack-Middleware-Debug-0.17/share/debug_toolbar/information.gif000644 000765 000024 00000002013 13243360176 025463 0ustar00miyagawastaff000000 000000 GIF89a<< """)))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;Plack-Middleware-Debug-0.17/share/debug_toolbar/panel_bg.png000644 000765 000024 00000000156 13243360176 024732 0ustar00miyagawastaff000000 000000 PNG  IHDRĉtEXtSoftwareAdobe ImageReadyqe<IDATxb3 EOIENDB`Plack-Middleware-Debug-0.17/share/debug_toolbar/toolbar.css000644 000765 000024 00000020042 13243360176 024625 0ustar00miyagawastaff000000 000000 /* 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:-999999px; 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 */ Plack-Middleware-Debug-0.17/share/debug_toolbar/toolbar.js000644 000765 000024 00000007331 13243360176 024457 0ustar00miyagawastaff000000 000000 jQuery.noConflict(); jQuery(function($j) { var COOKIE_NAME = 'plack_debug_panel'; $j.plDebug = function(data, klass) { $j.plDebug.init(); } $j.extend($j.plDebug, { init: function() { var current = null; $j('#plDebugPanelList li a').click(function() { if (!this.className) { return false; } current = $j('#plDebug #' + this.classList.item(0)); if (current.is(':visible')) { $j(document).trigger('close.plDebug'); $j(this).parent().removeClass('active'); } else { $j('.panelContent').hide(); // Hide any that are already open current.show(); $j.plDebug.open(); $j('#plDebugToolbar li').removeClass('active'); $j(this).parent().addClass('active'); } return false; }); $j('#plDebug a.plDebugClose').click(function() { $j(document).trigger('close.plDebug'); $j('#plDebugToolbar li').removeClass('active'); return false; }); $j('#plDebug a.remoteCall').click(function() { $j('#plDebugWindow').load(this.href, {}, function() { $j('#plDebugWindow a.plDebugBack').click(function() { $j(this).parent().parent().hide(); return false; }); }); $j('#plDebugWindow').show(); return false; }); $j('#plDebugTemplatePanel a.plTemplateShowContext').click(function() { $j.plDebug.toggle_arrow($j(this).children('.toggleArrow')) $j.plDebug.toggle_content($j(this).parent().next()); return false; }); $j('#plDebugSQLPanel a.plSQLShowStacktrace').click(function() { $j.plDebug.toggle_content($j('.plSQLHideStacktraceDiv', $j(this).parents('tr'))); return false; }); $j('#plHideToolBarButton').click(function() { $j.plDebug.hide_toolbar(true); return false; }); $j('#plShowToolBarButton').click(function() { $j.plDebug.show_toolbar(); return false; }); if ($j.cookie(COOKIE_NAME)) { $j.plDebug.hide_toolbar(false); } else { $j.plDebug.show_toolbar(false); } }, open: function() { // TODO: Decide if we should remove this }, toggle_content: function(elem) { if (elem.is(':visible')) { elem.hide(); } else { elem.show(); } }, close: function() { $j(document).trigger('close.plDebug'); return false; }, hide_toolbar: function(setCookie) { // close any sub panels $j('#plDebugWindow').hide(); // close all panels $j('.panelContent').hide(); $j('#plDebugToolbar li').removeClass('active'); // finally close toolbar $j('#plDebugToolbar').hide('fast'); $j('#plDebugToolbarHandle').show(); // Unbind keydown $j(document).unbind('keydown.plDebug'); if (setCookie) { $j.cookie(COOKIE_NAME, 'hide', { path: '/', expires: 10 }); } }, show_toolbar: function(animate) { // Set up keybindings $j(document).bind('keydown.plDebug', function(e) { if (e.keyCode == 27) { $j.plDebug.close(); } }); $j('#plDebugToolbarHandle').hide(); if (animate) { $j('#plDebugToolbar').show('fast'); } else { $j('#plDebugToolbar').show(); } $j.cookie(COOKIE_NAME, null, { path: '/', expires: -1 }); }, toggle_arrow: function(elem) { var uarr = String.fromCharCode(0x25b6); var darr = String.fromCharCode(0x25bc); elem.html(elem.html() == uarr ? darr : uarr); } }); $j(document).bind('close.plDebug', function() { // If a sub-panel is open, close that if ($j('#plDebugWindow').is(':visible')) { $j('#plDebugWindow').hide(); return; } // If a panel is open, close that if ($j('.panelContent').is(':visible')) { $j('.panelContent').hide(); return; } // Otherwise, just minimize the toolbar if ($j('#plDebugToolbar').is(':visible')) { $j.plDebug.hide_toolbar(true); return; } }); }); jQuery(function() { jQuery.plDebug(); }); Plack-Middleware-Debug-0.17/share/debug_toolbar/toolbar.min.css000644 000765 000024 00000014042 13243360176 025412 0ustar00miyagawastaff000000 000000 #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:.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:.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;}Plack-Middleware-Debug-0.17/share/debug_toolbar/toolbar.min.js000644 000765 000024 00000006427 13243360176 025246 0ustar00miyagawastaff000000 000000 jQuery.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.classList.item(0));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;h
% 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 compatibility # [ 'PanelName', key1 => $value1, ... ] $package = shift @$spec; $package = "Debug::$package" unless $package =~ /^\+/s; $builder->add_middleware($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; unless (ref $spec_copy) { $spec_copy = "Debug::$spec_copy" unless $spec_copy =~ /^\+/s;; } $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. Note that the code is injected B (C<< >>) so if there is no such tag, the debug panel will not be injected at all. 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 target 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, unless preceded by C<+>, in which case it's interpreted as an absolute name similar to how L handles such names, e.g. C<+My::Plack::Middleware::Debug::Something>. 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 component 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Base.pm000644 000765 000024 00000013572 13243360176 024664 0ustar00miyagawastaff000000 000000 package 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::Dumper::Concise; use Scalar::Util; our $VERSION = '0.17'; 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; return scalar Dumper( $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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/CatalystLog.pm000644 000765 000024 00000004050 13243360176 026227 0ustar00miyagawastaff000000 000000 package 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.17'; # 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/DBITrace.pm000644 000765 000024 00000002274 13243360176 025364 0ustar00miyagawastaff000000 000000 package 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.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Environment.pm000644 000765 000024 00000002717 13243360176 026315 0ustar00miyagawastaff000000 000000 package Plack::Middleware::Debug::Environment; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Memory.pm000644 000765 000024 00000002032 13243360176 025247 0ustar00miyagawastaff000000 000000 package Plack::Middleware::Debug::Memory; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/ModuleVersions.pm000644 000765 000024 00000003101 13243360176 026753 0ustar00miyagawastaff000000 000000 package Plack::Middleware::Debug::ModuleVersions; use 5.008; use strict; use warnings; use Module::Versions; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Panel.pm000644 000765 000024 00000000347 13243360176 025045 0ustar00miyagawastaff000000 000000 package 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; Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Parameters.pm000644 000765 000024 00000002512 13243360176 026105 0ustar00miyagawastaff000000 000000 package 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/PerlConfig.pm000644 000765 000024 00000002721 13243360176 026034 0ustar00miyagawastaff000000 000000 package Plack::Middleware::Debug::PerlConfig; use 5.008; use strict; use warnings; use Config; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Response.pm000644 000765 000024 00000003244 13243360176 025603 0ustar00miyagawastaff000000 000000 package Plack::Middleware::Debug::Response; use 5.008; use strict; use warnings; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Session.pm000644 000765 000024 00000000736 13243360176 025433 0ustar00miyagawastaff000000 000000 package 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/Timer.pm000644 000765 000024 00000004160 13243360176 025063 0ustar00miyagawastaff000000 000000 package Plack::Middleware::Debug::Timer; use 5.008; use strict; use warnings; use Time::HiRes; use parent qw(Plack::Middleware::Debug::Base); our $VERSION = '0.17'; 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 Plack-Middleware-Debug-0.17/lib/Plack/Middleware/Debug/TrackObjects.pm000644 000765 000024 00000002670 13243360176 026365 0ustar00miyagawastaff000000 000000 package 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 Plack-Middleware-Debug-0.17/examples/dbi/000755 000765 000024 00000000000 13243360176 021115 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/examples/hello-world/000755 000765 000024 00000000000 13243360176 022607 5ustar00miyagawastaff000000 000000 Plack-Middleware-Debug-0.17/examples/hello-world/app.psgi000644 000765 000024 00000000253 13243360176 024253 0ustar00miyagawastaff000000 000000 use Plack::Builder; my $app = sub { return [ 200, [ 'Content-Type' => 'text/html' ], [ 'Hello World' ] ]; }; builder { enable 'Debug'; $app; }; Plack-Middleware-Debug-0.17/examples/dbi/app.psgi000644 000765 000024 00000001122 13243360176 022555 0ustar00miyagawastaff000000 000000 # 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; }; Plack-Middleware-Debug-0.17/examples/dbi/dump.sql000644 000765 000024 00000000212 13243360176 022576 0ustar00miyagawastaff000000 000000 BEGIN TRANSACTION; CREATE TABLE foo (id integer, foo text); INSERT INTO "foo" VALUES(1,'bar'); INSERT INTO "foo" VALUES(2,'xxx'); COMMIT;