# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: 3ED <krzysztof1987 at gmail dot com>

pkgname=perl-module-implementation
pkgver=0.09
pkgrel=11
pkgdesc="Loads one of several alternate underlying implementations for a module"
arch=(any)
license=('PerlArtistic')
options=('!emptydirs')
depends=('perl-module-runtime>=0.012' 'perl-try-tiny')
checkdepends=('perl-test-requires' 'perl-test-fatal')
url="https://search.cpan.org/dist/Module-Implementation/"
source=(https://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Module-Implementation-$pkgver.tar.gz)
sha256sums=('c15f1a12f0c2130c9efff3c2e1afe5887b08ccd033bd132186d1e7d5087fd66d')

build() {
  cd "${srcdir}/Module-Implementation-${pkgver}"
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL="--skipdeps" \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='"$pkgdir"'" \
    PERL_MB_OPT="--installdirs vendor --destdir '"$pkgdir"'" \
    MODULEBUILDRC=/dev/null
  perl Makefile.PL
  make
}

check() {
  cd "${srcdir}/Module-Implementation-${pkgver}"
  make test
}

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