Files
perl-CGI-Application-Plugin…/perl-CGI-Application-Plugin-AutoRunmode.spec

90 lines
3.0 KiB
RPMSpec
Raw Permalink Normal View History

#
# spec file for package perl-CGI-Application-Plugin-AutoRunmode
#
# 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 CGI-Application-Plugin-AutoRunmode
Name: perl-CGI-Application-Plugin-AutoRunmode
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: CGI::App plugin to automatically register runmodes
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/T/TH/THILO/%{cpan_name}-%{cpan_version}.tar.gz
2025-08-12 18:12:14 +02:00
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(CGI::Application) >= 3
Requires: perl(CGI::Application) >= 3
Provides: perl(CGI::Application::Plugin::AutoRunmode) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
This plugin for CGI::Application provides easy ways to setup run modes. You
can just write the method that implement a run mode, you do not have to
explicitly register it with CGI::App anymore.
There are two approaches:
* Declare run modes with subroutine attributes.
You can flag methods in your CGI::App subclass with the attribute "Runmode"
or "StartRunmode" (these attributes are case-insensitive)
* Declare that every method in a class is a run mode.
You can assign a delegate object, all whose methods will become runmodes
You can also mix both approaches.
Delegate runmodes receive two parameters: The first one is the CGI::App
instance, followed by the delegate instance or class name. This can be
useful if you have delegate objects that contain state.
It is possible to chain multiple delegates by specifying an array reference
containing the delegate instances or class names. This chain is checked
from left to right and the runmode will be delegated to the first match.
It both cases, the resulting runmodes will have the same name as the
subroutine that implements them. They are activated by a cgiapp_prerun hook
provided by this plugin (if you are using CGI::Application older than
version 4, hooks are not available, and you can import a cgiapp_prerun
method instead).
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%changelog