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

_realname=Data-OptList
pkgname=perl-${_realname}
pkgver=0.114
pkgrel=1
pkgdesc="Parse and validate simple name/value option pairs"
arch=('any')
url="https://metacpan.org/dist/Data-OptList"
msys2_references=(
  'purl: pkg:cpan/RJBS/Data-OptList'
)
license=('PerlArtistic' 'GPL')
depends=('perl-Params-Util' 'perl-Scalar-List-Utils' 'perl-Sub-Install')
makedepends=('perl-ExtUtils-MakeMaker')
options=('!emptydirs')
source=("https://cpan.metacpan.org/authors/id/R/RJ/RJBS/${_realname}-${pkgver}.tar.gz")
sha512sums=('72f60ad7d9a6d87ffecfbc0f6f6d48dad2816dd4431d7e82e8ab834e0852da27420fd52fb2a1138254d80bf8b98b94b9fa25b878e1bb155221543a78219ee16a')

prepare() {
  cd ${_realname}-${pkgver}
}

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

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

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