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

_realname=Test-Warnings
pkgname=perl-${_realname}
pkgver=0.031
pkgrel=1
pkgdesc="Test for warnings and the lack of them"
arch=('any')
url="https://search.mcpan.org/dist/Test-Warnings"
license=('GPL' 'PerlArtistic')
depends=('perl')
options=('!emptydirs')
groups=('perl-modules')
source=("https://search.mcpan.org/CPAN/authors/id/E/ET/ETHER/${_realname}-${pkgver}.tar.gz")
sha256sums=('1e542909fef305e45563e9878ea1c3b0c7cef1b28bb7ae07eba2e1efabec477b')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='"${pkgdir}"'"     \
      PERL_MB_OPT="--installdirs vendor --destdir '"${pkgdir}"'" \
      PERL_USE_UNSAFE_INC=1 \
      MODULEBUILDRC=/dev/null

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

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

package() {
  cd ${_realname}-${pkgver}
  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}
