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

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

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}"
}
