Files
perl-Throwable-SugarFactory/perl-Throwable-SugarFactory.spec
2025-08-12 18:18:11 +02:00

122 lines
4.5 KiB
RPMSpec

#
# spec file for package perl-Throwable-SugarFactory
#
# Copyright (c) 2025 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 Throwable-SugarFactory
Name: perl-Throwable-SugarFactory
Version: 0.213.360
Release: 0
# 0.213360 -> normalize -> 0.213.360
%define cpan_version 0.213360
License: SUSE-Public-Domain
Summary: Build a library of syntax-sugared Throwable-based exceptions
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/M/MI/MITHALDU/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Class::Inspector)
BuildRequires: perl(Import::Into)
BuildRequires: perl(Module::Runtime)
BuildRequires: perl(Moo) >= 1.4
BuildRequires: perl(Moo::Role) >= 1.4
BuildRequires: perl(Package::Variant) >= 1.3.2
BuildRequires: perl(String::CamelCase)
BuildRequires: perl(Test::Fatal)
BuildRequires: perl(Test::InDistDir)
BuildRequires: perl(Throwable)
BuildRequires: perl(Throwable::Error)
BuildRequires: perl(Try::Tiny)
BuildRequires: perl(parent)
BuildRequires: perl(strictures) >= 2
Requires: perl(Class::Inspector)
Requires: perl(Import::Into)
Requires: perl(Module::Runtime)
Requires: perl(Moo) >= 1.4
Requires: perl(Moo::Role) >= 1.4
Requires: perl(Package::Variant) >= 1.3.2
Requires: perl(String::CamelCase)
Requires: perl(Throwable)
Requires: perl(parent)
Requires: perl(strictures) >= 2
Provides: perl(Constructor::Sugar) = %{version}
Provides: perl(Constructor::SugarLibrary) = %{version}
Provides: perl(MooX::BuildClass) = %{version}
Provides: perl(MooX::BuildClass::Utils) = %{version}
Provides: perl(MooX::BuildRole) = %{version}
Provides: perl(MooX::SugarFactory) = %{version}
Provides: perl(Throwable::SugarFactory) = %{version}
Provides: perl(Throwable::SugarFactory::Hashable) = %{version}
Provides: perl(Throwable::SugarFactory::Utils) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
This is an effort to create an exception library that is useful and pleases
my aesthetics. The explicit goals were:
1. Declare exception classes at runtime to remove the need for multiple
files.
2. Retain the use of the perl builtin 'die' to throw the exception, to
minimize the difference from common standard Perl code and thus increase
reading speed.
3. Gain ability to construct the exception class with a short function
call, to increase reading speed by removing the need to: Use the full class
name; mention the constructor name at all; use cumbersome method call
syntax and forced parens.
4. Gain ability to perform ISA checks with a short function call, also to
increase reading speed by removing the need to use the full class name.
To build an exception library with this module, simply 'use' the module in
your package, which sets it up as a library to export the constructor and
class name shortcuts you will be declaring with the exported keyword
'exception'.
To use the exceptions in your code, 'use' your exception library in the
module where you wish to throw exceptions, whereupon it will export the
shortcuts. You can then create the exception with the snake_cased
constructor function and call die to throw it, and when its caught, can
call ->isa with the CamelCased shortcut that returns the class name.
%prep
%autosetup -n %{cpan_name}-%{cpan_version} -p1
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
%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 README.PATCHING
%license LICENSE
%changelog