# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=File-Next
pkgname=perl-${_realname}
pkgver=1.18
pkgrel=2
pkgdesc="File-finding iterator"
arch=('any')
license=('PerlArtistic' 'GPL')
url="https://metacpan.org/dist/File-Next"
msys2_references=(
  "purl: pkg:cpan/PETDANCE/File-Next"
)
groups=('perl-modules')
depends=('perl')
options=(!emptydirs)
source=("https://www.cpan.org/authors/id/P/PE/PETDANCE/${_realname}-${pkgver}.tar.gz")
sha256sums=('f900cb39505eb6e168a9ca51a10b73f1bbde1914b923a09ecd72d9c02e6ec2ef')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  PERL_MM_USE_DEFAULT=1 PERL5LIB="" \
  PERL_AUTOINSTALL=--skipdeps \
  PERL_MM_OPT="INSTALLDIRS=vendor" \
  PERL_MB_OPT="--installdirs vendor" \
  MODULEBUILDRC=/dev/null \
    /usr/bin/perl Makefile.PL

  make
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  PERL_MM_USE_DEFAULT=1 PERL5LIB="" make test
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make install DESTDIR="${pkgdir}"
  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}
