# # spec file for package perl-Plack-Middleware-Debug # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name Plack-Middleware-Debug Name: perl-Plack-Middleware-Debug Version: 0.180.0 Release: 0 # 0.18 -> normalize -> 0.180.0 %define cpan_version 0.18 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Display information about the current request/response URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/%{cpan_name}-%{cpan_version}.tar.gz Source1: cpanspec.yml Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Class::Method::Modifiers) >= 1.05 BuildRequires: perl(Data::Dump) BuildRequires: perl(Data::Dumper::Concise) BuildRequires: perl(Encode) >= 2.23 BuildRequires: perl(File::ShareDir) >= 1.00 BuildRequires: perl(Module::Build) BuildRequires: perl(Module::Build::Tiny) >= 0.034 BuildRequires: perl(Plack) BuildRequires: perl(Plack::Test) BuildRequires: perl(Test::More) >= 0.70 BuildRequires: perl(Test::Requires) >= 0.08 BuildRequires: perl(Text::MicroTemplate) >= 0.150 BuildRequires: perl(parent) Requires: perl(Class::Method::Modifiers) >= 1.05 Requires: perl(Data::Dump) Requires: perl(Data::Dumper::Concise) Requires: perl(Encode) >= 2.23 Requires: perl(File::ShareDir) >= 1.00 Requires: perl(Plack) Requires: perl(Text::MicroTemplate) >= 0.150 Requires: perl(parent) Provides: perl(Plack::Middleware::Debug) = %{version} Provides: perl(Plack::Middleware::Debug::Base) = %{version} Provides: perl(Plack::Middleware::Debug::CatalystLog) = %{version} Provides: perl(Plack::Middleware::Debug::DBITrace) = %{version} Provides: perl(Plack::Middleware::Debug::Environment) = %{version} Provides: perl(Plack::Middleware::Debug::Memory) = %{version} Provides: perl(Plack::Middleware::Debug::ModuleVersions) = %{version} Provides: perl(Plack::Middleware::Debug::Panel) Provides: perl(Plack::Middleware::Debug::Parameters) Provides: perl(Plack::Middleware::Debug::PerlConfig) = %{version} Provides: perl(Plack::Middleware::Debug::Response) = %{version} Provides: perl(Plack::Middleware::Debug::Session) Provides: perl(Plack::Middleware::Debug::Timer) = %{version} Provides: perl(Plack::Middleware::Debug::TrackObjects) %undefine __perllib_provides %{perl_requires} %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. %prep %autosetup -n %{cpan_name}-%{cpan_version} find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build perl Build.PL --installdirs=vendor ./Build build --flags=%{?_smp_mflags} %check ./Build test %install ./Build install --destdir=%{buildroot} --create_packlist=0 %perl_gen_filelist %files -f %{name}.files %doc Changes examples README %license LICENSE %changelog