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

_realname=File-Listing
pkgname=perl-${_realname}
pkgver=6.16
pkgrel=1
pkgdesc="parse directory listing"
arch=('any')
license=('spdx:Artistic-1.0-Perl' 'spdx:GPL-1.0-or-later')
options=('!emptydirs')
depends=('perl>=5.8.8' 'perl-HTTP-Date>=6')
conflicts=('perl-libwww<6')
url="https://metacpan.org/dist/File-Listing"
msys2_references=(
  'purl: pkg:cpan/PLICEASE/File-Listing'
)
groups=('perl-modules')
source=("https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/${_realname}-${pkgver}.tar.gz")
sha256sums=('189b3a13fc0a1ba412b9d9ec5901e9e5e444cc746b9f0156d4399370d33655c6')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor"     \
      PERL_MB_OPT="--installdirs vendor" \
      MODULEBUILDRC=/dev/null

    cd ${srcdir}/${_realname}-${pkgver}
    /usr/bin/perl Makefile.PL
    make
  )
}

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

package() {
  cd ${srcdir}/${_realname}-${pkgver}
  make DESTDIR="$pkgdir" install
}
