# Detect the distribution in use
%global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g'
%global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]'
%global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release)
%global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4})
%global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace})
# Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel
%if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl"
%global __distinit rhel
%endif
# Dist tag for Fedora is still "fc"
%if "%{__distinit}" == "f"
%global __distinit fc
%endif

Name:		perl-Exception-Class
Version:	1.45
Release:	7.%{__distinit}%{__distvers}
Summary:	Module that allows you to declare real exception classes in Perl
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/release/Exception-Class
Source0:	https://cpan.metacpan.org/modules/by-module/Exception/Exception-Class-%{version}.tar.gz
BuildArch:	noarch
# Module Build
BuildRequires:	coreutils
BuildRequires:	findutils
BuildRequires:	make
BuildRequires:	perl-generators
BuildRequires:	perl-interpreter
BuildRequires:	perl(ExtUtils::MakeMaker)
# Module Runtime
BuildRequires:	perl(base)
BuildRequires:	perl(Carp)
BuildRequires:	perl(Class::Data::Inheritable) >= 0.02
BuildRequires:	perl(Devel::StackTrace) >= 2.00
BuildRequires:	perl(overload)
BuildRequires:	perl(Scalar::Util)
BuildRequires:	perl(strict)
BuildRequires:	perl(warnings)
# Test Suite
BuildRequires:	perl(File::Spec)
BuildRequires:	perl(Test::More) >= 0.96
# Optional Tests
BuildRequires:	perl(CPAN::Meta) >= 2.120900
BuildRequires:	perl(CPAN::Meta::Prereqs)
# Dependencies
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif

%description
Exception::Class allows you to declare exception hierarchies in your
modules in a "Java-esque" manner.

%prep
%setup -q -n Exception-Class-%{version}

%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}

%install
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -delete
%{_fixperms} -c %{buildroot}

%check
make test

%files
%license LICENSE
%doc Changes CODE_OF_CONDUCT.md CONTRIBUTING.md README.md
%{perl_vendorlib}/Exception/
%{_mandir}/man3/Exception::Class.3*
%{_mandir}/man3/Exception::Class::Base.3*

%changelog
* Sat Apr  8 2023 Paul Howarth <paul@city-fan.org> - 1.45-7
- Use SPDX-format license tag

* Mon May  3 2021 Paul Howarth <paul@city-fan.org> - 1.45-1
- Update to 1.45
  - The field names for an exception are now checked to ensure that they are
    valid Perl identifiers (GH#13)
- Package new CODE_OF_CONDUCT.md file
- Use %%license unconditionally

* Tue Jun  4 2019 Paul Howarth <paul@city-fan.org> - 1.44-6
- Perl 5.30 rebuild

* Mon Dec 11 2017 Paul Howarth <paul@city-fan.org> - 1.44-1
- Update to 1.44
  - You can now pass "frame_filter", "filter_frames_early" and "skip_frames"
    to the throw() method of an exception class; these will be passed on to
    the Devel::StackTrace constructor (GH#6)
- BR: perl-generators unconditionally
- BR: perl-interpreter rather than perl

* Mon Jul 10 2017 Paul Howarth <paul@city-fan.org> - 1.43-1
- Update to 1.43
  - The full_message() method in Exception::Class::Base now calls message()
    instead of accessing the object's hash key, which makes it easier to
    override message() in a subclass (GH#11)
- Drop support for EOL distributions prior to F-13
  - Drop BuildRoot: and Group: tags
  - Drop explicit buildroot cleaning in %%install section
  - Drop explicit %%clean section
  - Drop workaround for building with Test::More < 0.96

* Thu Jan  5 2017 Paul Howarth <paul@city-fan.org> - 1.42-1
- Update to 1.42
  - Generated exception classes are now added to %%INC; if you subclass a
    generated class with "use base" then base.pm will no longer attempt to load
    the requested class (GH#8)

* Fri Dec  9 2016 Paul Howarth <paul@city-fan.org> - 1.41-1
- Update to 1.41
  - Switch to GitHub Issues
- Update patch for building with old versions of Test::More
- Author/Release tests moved to xt/, so don't bother trying to run them

* Mon Aug 22 2016 Paul Howarth <paul@city-fan.org> - 1.40-3
- BR: perl-generators where available
- Simplify find command using -delete

* Sat Jan 30 2016 Paul Howarth <paul@city-fan.org> - 1.40-1
- Update to 1.40
  - Fixed broken metadata (GH#3)
- Update patch for building with old versions of Test::More
- Add patch to support building without Test::Code::TidyAll

* Thu Nov 13 2014 Paul Howarth <paul@city-fan.org> - 1.39-2
- License should be same as perl, no longer Artistic 2.0

* Mon Nov  3 2014 Paul Howarth <paul@city-fan.org> - 1.39-1
- Update to 1.39
  - Replaced the Exception::Class::Base->NoRefs method with UnsafeRefCapture to
    match changes in Devel::StackTrace 2.00; the old method is deprecated but
    will continue to work
- Update patch for building with old versions of Test::More
- Classify buildreqs by usage

* Tue Sep 16 2014 Paul Howarth <paul@city-fan.org> - 1.38-3
- Use %%license where possible

* Mon May  5 2014 Paul Howarth <paul@city-fan.org> - 1.38-1
- Update to 1.38
  - An exception without a message will now default to either the associated
    exception class description or the string "[Generic exception]" (PR #2)
  - Added field_hash() and context_hash() methods (PR #1)
- Update patch for building with old versions of Test::More
- Drop spelling patch, no longer needed
- Drop support for old distributions prior to FC-5
  - Drop patch for building with ExtUtils::MakeMaker < 6.30
  - Drop %%defattr, redundant since rpm 4.4

* Sun Feb 24 2013 Paul Howarth <paul@city-fan.org> - 1.37-1
- Update to 1.37
  - I now recommend you use Throwable instead of this module; it has a nicer,
    more modern interface
  - Fixed various bugs and confusion in the docs
- Add patch to account for Test::Spelling case sensitivity

* Sat Nov 17 2012 Paul Howarth <paul@city-fan.org> - 1.36-1
- Update to 1.36
  - Fixed some stupidity in the tests that appears to have been highlighted by
    recent changes to Devel::StackTrace (CPAN RT#81245)
- Drop upstreamed stopwords patch
- Update other patches

* Mon Sep 17 2012 Paul Howarth <paul@city-fan.org> - 1.35-1
- Update to 1.35
  - Require Class::Data::Inheritable ≥ 0.02

* Mon Sep 17 2012 Paul Howarth <paul@city-fan.org> - 1.34-1
- Update to 1.34
  - 1.33 did not declare any prereqs (CPAN RT#79677)
- Drop version requirement for perl(Class::Data::Inheritable)
- Update patch for building with old versions of Test::More

* Sun Sep 16 2012 Paul Howarth <paul@city-fan.org> - 1.33-1
- Update to 1.33
  - Fixed warning from basic.t on 5.17.x (CPAN RT#79121)
- Update patch for building with old ExtUtils::MakeMaker versions
- Update stopwords patch, mostly upstream now
- Drop BR: perl(Test::Kwalitee), not longer used
- Bump perl(Test::Pod) version requirement to 1.41

* Wed Jul 11 2012 Paul Howarth <paul@city-fan.org> - 1.32-5
- BR: perl(base), perl(File::Spec) and perl(Scalar::Util)
- Don't need to remove empty directories from the buildroot
- Drop support for old distributions prior to FC-3:
  - Don't need to define %%{perl_vendorlib}
  - Use DESTDIR rather than PERL_INSTALL_ROOT

* Fri Jun 24 2011 Paul Howarth <paul@city-fan.org> - 1.32-4
- Rebuild for perl 5.14.1 in Rawhide
- BR: perl(Test::Kwalitee) unconditionally
- Use %%{_fixperms} macro instead of our own %%{__chmod} incantation
- Nobody else likes macros for commands
- Fix dist tag for CentOS 6 and Scientific Linux

* Tue Mar 22 2011 Paul Howarth <paul@city-fan.org> - 1.32-3
- BR: perl(Test::Kwalitee)

* Mon Feb 14 2011 Paul Howarth <paul@city-fan.org> - 1.32-2
- Update stopwords patch - dictionary coverage in Rawhide appears to have gone
  down

* Tue Jun 29 2010 Paul Howarth <paul@city-fan.org> - 1.32-1
- Update to 1.32 (removed Test::Most dependency, which was causing a circular
  dependency chain [CPAN RT#58889])

* Mon Jun 28 2010 Paul Howarth <paul@city-fan.org> - 1.31-1
- Update to 1.31 (made it possible to use Exception::Class::Base without
  loading Exception::Class [CPAN RT#57269])
- Author tests are back from xt/ to t/
- Update stopwords and old-Test::More patches
- License changed to Artistic 2.0
- Package README
- BR: perl(Test::EOL) and perl(Test::NoTabs)
- Add patch to build with ExtUtils::MakeMaker < 6.31

* Wed Jun 23 2010 Paul Howarth <paul@city-fan.org> - 1.30-3
- Rebuild for perl 5.12.1 in Rawhide

* Tue Jun  8 2010 Paul Howarth <paul@city-fan.org> - 1.30-2
- Fix dist tag for RHEL-6 Beta

* Mon Mar 22 2010 Paul Howarth <paul@city-fan.org> - 1.30-1
- Update to 1.30 (add ability to create lightweight exceptions - CPAN RT#54826)
- Drop build hack for perl 5.8.6 and earlier, no longer needed
- Add patch to support builds with Test::More < 0.88
- Don't need to fix permissions in %%prep any more
- Run extra author tests
- Add buildreqs perl(Test::Spelling) and aspell-en for spelling test

* Wed Nov 25 2009 Paul Howarth <paul@city-fan.org> - 1.29-2
- Import from Fedora

* Thu Jul 30 2009 Ralf Corsépius <corsepiu@fedoraproject.org> - 1.29-1
- Upstream update (required by other packages, fix mass rebuild breakdowns)

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.26-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.26-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Dec 12 2008 Steven Pritchard <steve@kspei.com> 1.26-1
- Update to 1.26
- Bump Devel::StackTrace dependency to 1.20

* Sat May 31 2008 Steven Pritchard <steve@kspei.com> 1.24-1
- Update to 1.24
- Bump Devel::StackTrace dependency to 1.17
- Clean up to match current cpanspec output
- Improve Summary and description
- Build with Module::Build
- BR Test::Pod and Test::Pod::Coverage and define IS_MAINTAINER

* Wed Feb 27 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.23-6
- Rebuild for perl 5.10 (again)

* Mon Jan 14 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.23-5
- Rebuild against new perl

* Sat Dec 29 2007 Ralf Corsépius 1.23-4
- BR: perl(Test::More) (BZ 419631)
- Adjust License-tag

* Tue Apr 17 2007 Steven Pritchard <steve@kspei.com> 1.23-3
- Use fixperms macro instead of our own chmod incantation
- BR ExtUtils::MakeMaker

* Sat Sep 16 2006 Steven Pritchard <steve@kspei.com> 1.23-2
- Canonicalize Source0 URL
- Fix find option order
- Drop executable bit from Exception/Class.pm to avoid a rpmlint warning

* Fri Feb 03 2006 Steven Pritchard <steve@kspei.com> 1.23-1
- Update to 1.23

* Tue Jan 10 2006 Steven Pritchard <steve@kspei.com> 1.22-1
- Update to 1.22

* Mon Sep 05 2005 Steven Pritchard <steve@kspei.com> 1.21-3
- Remove explicit core module dependencies
- Add COPYING and Artistic

* Wed Aug 17 2005 Steven Pritchard <steve@kspei.com> 1.21-2
- Minor spec cleanup

* Tue Aug 16 2005 Steven Pritchard <steve@kspei.com> 1.21-1
- Specfile autogenerated