%bcond_with test
# Run optional test
%bcond_with perl_Params_ValidationCompiler_enables_optional_test

Summary:	Build an optimized subroutine parameter validator once, use it forever
Name:		perl-Params-ValidationCompiler
Version:	0.30
Release:	4%{?_dist_release}
Group:		programming
Vendor:		Project Vine
Distribution:	Vine Linux

License:	Artistic 2.0
URL:		https://metacpan.org/release/Params-ValidationCompiler
Source0:	https://cpan.metacpan.org/modules/by-module/Params/Params-ValidationCompiler-%{version}.tar.gz

BuildArch:	noarch

# Build
BuildRequires:	coreutils
BuildRequires:	make
BuildRequires:	perl >= 2:5.34.0
BuildRequires:	perl(ExtUtils::MakeMaker)
# Module
BuildRequires:	perl(B)
BuildRequires:	perl(Carp)
#BuildRequires:	perl(Class::XSAccessor)
BuildRequires:	perl(Eval::Closure)
BuildRequires:	perl(Exception::Class)
BuildRequires:	perl(Exporter)
BuildRequires:	perl(List::Util)
BuildRequires:	perl(overload)
BuildRequires:	perl(Scalar::Util)
BuildRequires:	perl(strict)
BuildRequires:	perl(warnings)
# Optional Functionality
BuildRequires:	perl(Sub::Util)
%if %{with test}
# Test Suite
BuildRequires:	perl(File::Spec)
BuildRequires:	perl(Specio)
BuildRequires:	perl(Specio::Declare)
BuildRequires:	perl(Specio::Library::Builtins)
BuildRequires:	perl(Test2::Plugin::NoWarnings)
BuildRequires:	perl(Test2::Require::Module)
BuildRequires:	perl(Test2::V0)
BuildRequires:	perl(Test::More)
BuildRequires:	perl(Test::Without::Module)
%if %{with perl_Params_ValidationCompiler_enables_optional_test}
# Optional Tests
BuildRequires:	perl(Const::Fast)
BuildRequires:	perl(CPAN::Meta)
BuildRequires:	perl(CPAN::Meta::Prereqs)
BuildRequires:	perl(Hash::Util)
%if !%{defined perl_bootstrap}
# Avoid build dependency cycles via Moose and DateTime
BuildRequires:	perl(Moose::Util::TypeConstraints)
BuildRequires:	perl(Types::Standard)
%endif
%endif
%endif
# Dependencies
Requires:	perl >= 2:5.34.0
Recommends:	perl(Class::XSAccessor)
Recommends:	perl(Sub::Util)

%description
Create a customized, optimized, non-lobotomized, uncompromised, and thoroughly
specialized parameter checking subroutine.


%prep
%setup -q -n Params-ValidationCompiler-%{version}


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


%install
make install DESTDIR=%{buildroot}
%{_fixperms} -c %{buildroot}


%if %{with test}
%check
make test
%endif


%files
%license LICENSE
%doc Changes CODE_OF_CONDUCT.md CONTRIBUTING.md eg/ README.md
%{perl_vendorlib}/Params/
%{_mandir}/man3/Params::ValidationCompiler.3*
%{_mandir}/man3/Params::ValidationCompiler::Compiler.3*
%{_mandir}/man3/Params::ValidationCompiler::Exceptions.3*


%changelog
* Sun Nov 21 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.30-4
- rebuilt with perl-5.34.0.

* Sun May 19 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.30-3
- initial build for Vine Linux.

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Wed Aug  1 2018 Paul Howarth <paul@city-fan.org> - 0.30-1
- Update to 0.30
  - Added a new option for named params, "return_object", which causes the
    validation sub to return an object with methods for each param rather than
    a hashref; this is a great way to avoid typos in hash keys (idea
    shamelessly stolen from Toby Inkster's Type::Params module)
  - Tweaked the POD formatting so that the table of contents generated by
    MetaCPAN is more useful
  - Optionally use Class::XSAccessor

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.27-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sun Jul 01 2018 Jitka Plesnikova <jplesnik@redhat.com> - 0.27-3
- Perl 5.28 re-rebuild of bootstrapped packages

* Fri Jun 29 2018 Jitka Plesnikova <jplesnik@redhat.com> - 0.27-2
- Perl 5.28 rebuild

* Mon Feb 12 2018 Paul Howarth <paul@city-fan.org> - 0.27-1
- Update to 0.27
  - Fixed a bug with inlining Moose types: if a type's parent needed
    environment variables, those would not get closed over (GH#22)
  - Added a debug option to dump the source of the subroutine before it is
    eval'd

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.26-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Nov 28 2017 Paul Howarth <paul@city-fan.org> - 0.26-1
- Update to 0.26
  - The exceptions.t test would fail if Sub::Util was not installed (GH#19)
  - Fix test failures on Windows (GH#20)

* Fri Nov 24 2017 Paul Howarth <paul@city-fan.org> - 0.25-1
- Update to 0.25
  - All exceptions now include a stack trace by default when treated as a
    string; this makes finding where validation failed a lot easier (GH#18)
  - The name for a subroutine is now used in some exception messages, even if
    Sub::Util cannot be installed

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.24-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Wed Jun 07 2017 Jitka Plesnikova <jplesnik@redhat.com> - 0.24-3
- Perl 5.26 re-rebuild of bootstrapped packages

* Mon Jun 05 2017 Jitka Plesnikova <jplesnik@redhat.com> - 0.24-2
- Perl 5.26 rebuild

* Sun Apr  9 2017 Paul Howarth <paul@city-fan.org> - 0.24-1
- Update to 0.24
  - The source_for() exported by Params::ValidationCompiler did not work at all
    (GH#16)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Jan 23 2017 Paul Howarth <paul@city-fan.org> - 0.23-1
- Update to 0.23
  - Trying to create a validator for positional parameters where a required
    param came after one with a default did not throw an exception
  - A positional params validator with a slurpy type that had coercions did not
    return the coerced values; it returned the original values instead

* Sat Dec 31 2016 Paul Howarth <paul@city-fan.org> - 0.22-1
- Update to 0.22
  - Explicitly load the B module; previously, the code relied on this already
    being loaded by something else (GH#11)
  - Removed the alpha warning from the docs

* Wed Dec  7 2016 Paul Howarth <paul@city-fan.org> - 0.21-1
- Update to 0.21
  - Switched to using GitHub issues

* Tue Dec  6 2016 Paul Howarth <paul@city-fan.org> - 0.20-1
- Update to 0.20
  - The keys for parameter specifications are now validated, and if an unknown
    key is seen then an exception will be thrown; this will help you catch
    typos in your parameter specification (GH#8)

* Tue Nov 22 2016 Paul Howarth <paul@city-fan.org> - 0.19-1
- Update to 0.19
  - Non-inlinable Specio types caused a syntax error when used with positional
    params
  - Positional params with coercions and defaults did not work properly; the
    coerced value and the default would simply not be returned in any case

* Mon Nov 14 2016 Paul Howarth <paul@city-fan.org> - 0.18-1
- Update to 0.18
  - Using coercions with positional parameters could cause a "Modification of a
    read-only value attempted" exception when the generated code tried to
    assign to elements of @_; this is now fixed by making a copy if any of the
    types have a coercion
  - Using Moose types with coercions in a positional params check would cause
    invalid code to be generated; this could also happen with Type::Tiny if
    either the type or a coercion could not be inlined

* Mon Nov  7 2016 Paul Howarth <paul@city-fan.org> - 0.17-1
- Update to 0.17
  - When using positional parameters, parameters with a default are now
    optional; for named parameters, this was already the case

* Fri Nov  4 2016 Paul Howarth <paul@city-fan.org> - 0.16-1
- Update to 0.16
  - Previously, using a default with a positional parameter would result in an
    error when compiling the validator subroutine; defaults now work with
    positional parameters (GH#5)
  - Moose and Specio types (and coercions) that provide variables to close over
    when being inlined did not always compile properly; most notably, this was
    not being handled at all for Moose types, and not completely handled for
    Specio coercions

* Thu Nov  3 2016 Paul Howarth <paul@city-fan.org> - 0.14-1
- Update to 0.14
  - Added a "named_to_list" option to support returning only the parameter
    values from a named parameter validator rather than the key-value pairs
    (GH#4)
  - Errors from calls to validation_for() now use croak so as to show up at the
    call site, rather than in the internals

* Wed Oct 26 2016 Petr Pisar <ppisar@redhat.com> - 0.13-4
- Break build cycle: perl-Moose → perl-DateTime → perl-Params-ValidationCompiler

* Mon Sep 19 2016 Paul Howarth <paul@city-fan.org> - 0.13-3
- Drop unused BR: findutils (#1377252)

* Mon Sep 19 2016 Paul Howarth <paul@city-fan.org> - 0.13-2
- Sanitize for Fedora submission

* Sun Sep 18 2016 Paul Howarth <paul@city-fan.org> - 0.13-1
- Initial RPM version
