Initial import (perl-Module-Implementation-0.03-3)

This module abstracts out the process of choosing one of several underlying
implementations for a module. This can be used to provide XS and pure Perl
implementations of a module, or it could be used to load an implementation
for a given OS or any other case of needing to provide multiple
implementations.

This module is only useful when you know all the implementations ahead of
time. If you want to load arbitrary implementations then you probably want
something like a plugin system, not this module.
This commit is contained in:
Paul Howarth 2012-02-08 16:02:35 +00:00
parent c11a5f2c20
commit d407a789f3
4 changed files with 279 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/Module-Implementation-[0-9.]*.tar.gz

View File

@ -0,0 +1,168 @@
diff -up Module-Implementation-0.03/t/basic.t.orig Module-Implementation-0.03/t/basic.t
--- Module-Implementation-0.03/t/basic.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/basic.t 2012-02-07 10:04:29.846798279 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 5;
{
package T;
@@ -29,5 +29,3 @@ use Test::More 0.88;
is( T::return_42(), 42, 'T::return_42 work as expected' );
is( T::_implementation(), 'Impl1', 'T::_implementation returns default implementation' );
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/both-fail.t.orig Module-Implementation-0.03/t/both-fail.t
--- Module-Implementation-0.03/t/both-fail.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/both-fail.t 2012-02-07 10:04:29.875798277 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 1;
use Test::Fatal;
{
@@ -24,5 +24,3 @@ use Test::Fatal;
'Got an exception when all implementations fail to load'
);
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/env-value.t.orig Module-Implementation-0.03/t/env-value.t
--- Module-Implementation-0.03/t/env-value.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/env-value.t 2012-02-07 10:04:30.005798265 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 4;
{
package T;
@@ -31,5 +31,3 @@ use Test::More 0.88;
is( T::return_42(), 42, 'T::return_42 work as expected' );
is( T::_implementation(), 'Impl2', 'T::_implementation returns implementation set in ENV' );
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/more-symbols.t.orig Module-Implementation-0.03/t/more-symbols.t
--- Module-Implementation-0.03/t/more-symbols.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/more-symbols.t 2012-02-07 10:04:30.042798260 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 7;
{
package T;
@@ -43,5 +43,3 @@ use Test::More 0.88;
'%T::HASH was copied from implementation'
);
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/one-impl-fails1.t.orig Module-Implementation-0.03/t/one-impl-fails1.t
--- Module-Implementation-0.03/t/one-impl-fails1.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/one-impl-fails1.t 2012-02-07 10:04:30.042798260 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 2;
{
package T;
@@ -24,5 +24,3 @@ use Test::More 0.88;
ok( T->can('return_42'), 'T package has a return_42 sub' );
ok( !T->can('return_package'), 'T package has a return_package sub' );
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/one-impl-fails2.t.orig Module-Implementation-0.03/t/one-impl-fails2.t
--- Module-Implementation-0.03/t/one-impl-fails2.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/one-impl-fails2.t 2012-02-07 10:04:30.043798260 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 2;
{
package T;
@@ -24,5 +24,3 @@ use Test::More 0.88;
ok( T->can('return_42'), 'T package has a return_42 sub' );
ok( !T->can('return_package'), 'T package has a return_package sub' );
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/release-cpan-changes.t.orig Module-Implementation-0.03/t/release-cpan-changes.t
--- Module-Implementation-0.03/t/release-cpan-changes.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/release-cpan-changes.t 2012-02-07 10:07:00.466837268 +0000
@@ -1,15 +1,11 @@
#!perl
+use Test::More;
+
BEGIN {
- unless ($ENV{RELEASE_TESTING}) {
- require Test::More;
- Test::More::plan(skip_all => 'these tests are for release candidate testing');
- }
+ plan skip_all => 'these tests are for release candidate testing' unless ($ENV{RELEASE_TESTING});
+ eval 'use Test::CPAN::Changes';
+ plan skip_all => 'Test::CPAN::Changes required for this test' if $@;
}
-
-use Test::More;
-eval 'use Test::CPAN::Changes';
-plan skip_all => 'Test::CPAN::Changes required for this test' if $@;
changes_ok();
-done_testing();
diff -up Module-Implementation-0.03/t/requested-fails.t.orig Module-Implementation-0.03/t/requested-fails.t
--- Module-Implementation-0.03/t/requested-fails.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/requested-fails.t 2012-02-07 10:04:30.043798260 +0000
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 1;
use Test::Fatal;
{
@@ -26,5 +26,3 @@ use Test::Fatal;
'Got an exception when implementation requested in env value fails to load'
);
}
-
-done_testing();
diff -up Module-Implementation-0.03/t/taint.t.orig Module-Implementation-0.03/t/taint.t
--- Module-Implementation-0.03/t/taint.t.orig 2012-02-06 23:03:58.000000000 +0000
+++ Module-Implementation-0.03/t/taint.t 2012-02-07 10:04:30.043798260 +0000
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More 0.88;
+use Test::More tests => 3;
use Test::Fatal;
use Test::Taint;
@@ -35,5 +35,3 @@ taint_checking_ok();
{
is( T::_implementation(), 'Impl2', 'T::_implementation returns implementation set in ENV' );
}
-
-done_testing();

View File

@ -0,0 +1,109 @@
# We need to patch the test suite if we have an old version of Test::More
%global old_test_more %(perl -MTest::More -e 'print (($Test::More::VERSION < 0.88) ? 1 : 0);' 2>/dev/null || echo 0)
# Test::CPAN::Changes isn't available in EPEL < 7, due to requirement of perl(version) ≥ 0.79
%global cpan_changes_available %(expr 0%{?fedora} + 0%{?rhel} '>' 6)
#TODO: BR: Test::Pod::No404s when available
#TODO: BR: Test::Pod::LinkCheck when available
Name: perl-Module-Implementation
Version: 0.03
Release: 3%{?dist}
Summary: Loads one of several alternate underlying implementations for a module
Group: Development/Libraries
License: Artistic 2.0
URL: http://search.cpan.org/dist/perl-Module-Implementation/
Source0: http://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Module-Implementation-%{version}.tar.gz
Patch1: Module-Implementation-0.03-old-Test::More.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildArch: noarch
# ===================================================================
# Build requirements
# ===================================================================
BuildRequires: perl(ExtUtils::MakeMaker)
# ===================================================================
# Module requirements
# ===================================================================
BuildRequires: perl(Carp)
BuildRequires: perl(Module::Runtime) >= 0.011
BuildRequires: perl(Try::Tiny)
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
# ===================================================================
# Test suite requirements
# ===================================================================
BuildRequires: perl(lib)
BuildRequires: perl(Test::Fatal)
BuildRequires: perl(Test::More)
BuildRequires: perl(Test::Taint)
# ===================================================================
# Author/Release test requirements
# ===================================================================
%if %{cpan_changes_available}
BuildRequires: perl(Test::CPAN::Changes)
%endif
BuildRequires: perl(Test::EOL)
BuildRequires: perl(Test::NoTabs)
BuildRequires: perl(Test::Pod)
BuildRequires: perl(Test::Spelling), aspell-en
# ===================================================================
# Runtime requirements
# ===================================================================
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(Carp)
%description
This module abstracts out the process of choosing one of several underlying
implementations for a module. This can be used to provide XS and pure Perl
implementations of a module, or it could be used to load an implementation
for a given OS or any other case of needing to provide multiple
implementations.
This module is only useful when you know all the implementations ahead of
time. If you want to load arbitrary implementations then you probably want
something like a plugin system, not this module.
%prep
%setup -q -n Module-Implementation-%{version}
# We have to patch the test suite if we have an old Test::More
%if %{old_test_more}
%patch1 -p1
%endif
%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
find %{buildroot} -depth -type d -exec rmdir {} \; 2>/dev/null
%{_fixperms} %{buildroot}
%check
make test RELEASE_TESTING=1
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc Changes LICENSE README
%{perl_vendorlib}/Module/
%{_mandir}/man3/Module::Implementation.3pm*
%changelog
* Wed Feb 8 2012 Paul Howarth <paul@city-fan.org> - 0.03-3
- Incorporate feedback from package review (#788258)
- Correct License tag, which should be Artistic 2.0
- BR: perl(lib) for test suite
- Explicitly require perl(Carp), not automatically detected
* Tue Feb 7 2012 Paul Howarth <paul@city-fan.org> - 0.03-2
- Sanitize for Fedora submission
* Tue Feb 7 2012 Paul Howarth <paul@city-fan.org> - 0.03-1
- Initial RPM version

View File

@ -0,0 +1 @@
0698d0874f518260265be2d49fe869b1 Module-Implementation-0.03.tar.gz