Hello community,
here is the log from the commit of package perl-Test-Without-Module for openSUSE:Factory checked in at 2017-04-11 12:43:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Test-Without-Module (Old)
and /work/SRC/openSUSE:Factory/.perl-Test-Without-Module.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Without-Module"
Tue Apr 11 12:43:58 2017 rev:5 rq:486144 version:0.19
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Test-Without-Module/perl-Test-Without-Module.changes 2015-04-15 16:27:21.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Test-Without-Module.new/perl-Test-Without-Module.changes 2017-04-11 12:43:59.632506940 +0200
@@ -1,0 +2,6 @@
+Fri Mar 31 06:51:57 UTC 2017 - coolo@suse.com
+
+- updated to 0.19
+ see /usr/share/doc/packages/perl-Test-Without-Module/Changes
+
+-------------------------------------------------------------------
Old:
----
Test-Without-Module-0.18.tar.gz
New:
----
Test-Without-Module-0.19.tar.gz
cpanspec.yml
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Test-Without-Module.spec ++++++
--- /var/tmp/diff_new_pack.TYHkfo/_old 2017-04-11 12:44:00.648363403 +0200
+++ /var/tmp/diff_new_pack.TYHkfo/_new 2017-04-11 12:44:00.648363403 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Test-Without-Module
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,14 +17,15 @@
Name: perl-Test-Without-Module
-Version: 0.18
+Version: 0.19
Release: 0
%define cpan_name Test-Without-Module
Summary: Test fallback behaviour in absence of modules
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Test-Without-Module/
-Source: http://www.cpan.org/authors/id/C/CO/CORION/%{cpan_name}-%{version}.tar.gz
+Source0: https://cpan.metacpan.org/authors/id/C/CO/CORION/%{cpan_name}-%{version}.tar.gz
+Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
@@ -38,7 +39,7 @@
%prep
%setup -q -n %{cpan_name}-%{version}
-find . -type f -print0 | xargs -0 chmod 644
+find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
@@ -54,6 +55,6 @@
%files -f %{name}.files
%defattr(-,root,root,755)
-%doc Changes README
+%doc Changes README README.mkdn
%changelog
++++++ Test-Without-Module-0.18.tar.gz -> Test-Without-Module-0.19.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/Changes new/Test-Without-Module-0.19/Changes
--- old/Test-Without-Module-0.18/Changes 2014-08-30 15:28:56.000000000 +0200
+++ new/Test-Without-Module-0.19/Changes 2017-03-30 21:14:13.000000000 +0200
@@ -3,6 +3,11 @@
Todo:
- Add way to allow only core modules (suggested by SREZIC)
+0.19 to be released
+ - Make error message more like the original Perl error message (haarg)
+ - Makefile.PL overhaul (by Abzal Serekov)
+ - Generate README.md
+
0.18 20140830
- Eliminate segfault on Perl 5.8 (by Graham Knop, Karen Etheridge, RT 98207)
- Only add the @INC hook once (by Graham Knop, RT #91857)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/MANIFEST new/Test-Without-Module-0.19/MANIFEST
--- old/Test-Without-Module-0.18/MANIFEST 2014-08-30 15:32:08.000000000 +0200
+++ new/Test-Without-Module-0.19/MANIFEST 2017-03-30 21:14:13.000000000 +0200
@@ -6,11 +6,13 @@
META.json
META.yml
README
+README.mkdn
t/01-api.t
t/02-block-use-module.t
t/03-block-require-module.t
t/04-import-export.t
t/05-redefine.t
+t/06-missing-hidden-modules.t
t/99-manifest.t
t/99-pod.t
t/99-todo.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/META.json new/Test-Without-Module-0.19/META.json
--- old/Test-Without-Module-0.18/META.json 2014-08-30 15:32:37.000000000 +0200
+++ new/Test-Without-Module-0.19/META.json 2017-03-30 21:14:16.000000000 +0200
@@ -3,8 +3,8 @@
"author" : [
"Max Maischein "
],
- "dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921",
+ "dynamic_config" : 0,
+ "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
@@ -19,28 +19,24 @@
"inc"
]
},
- "prereqs" : {
- "build" : {
- "requires" : {
- "File::Find" : "0",
- "File::Spec" : "0",
- "Test::More" : "0"
- }
- },
- "configure" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "0"
- }
- },
- "runtime" : {
- "requires" : {}
+ "provides" : {
+ "Test::Without::Module" : {
+ "file" : "lib/Test/Without/Module.pm",
+ "version" : "0.19"
}
},
"release_status" : "stable",
"resources" : {
+ "license" : [
+ "http://dev.perl.org/licenses/"
+ ],
"repository" : {
- "url" : "http://github.com/Corion/test-without-module"
+ "type" : "git",
+ "url" : "git://github.com/Corion/test-without-module.git",
+ "web" : "https://github.com/Corion/test-without-module"
}
},
- "version" : "0.18"
+ "version" : "0.19",
+ "x_serialization_backend" : "JSON::PP version 2.27202",
+ "x_static_install" : 1
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/META.yml new/Test-Without-Module-0.19/META.yml
--- old/Test-Without-Module-0.18/META.yml 2014-08-30 15:32:37.000000000 +0200
+++ new/Test-Without-Module-0.19/META.yml 2017-03-30 21:14:16.000000000 +0200
@@ -2,24 +2,25 @@
abstract: 'Test fallback behaviour in absence of modules'
author:
- 'Max Maischein '
-build_requires:
- File::Find: 0
- File::Spec: 0
- Test::More: 0
-configure_requires:
- ExtUtils::MakeMaker: 0
-dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921'
+build_requires: {}
+dynamic_config: 0
+generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Test-Without-Module
no_index:
directory:
- t
- inc
-requires: {}
+provides:
+ Test::Without::Module:
+ file: lib/Test/Without/Module.pm
+ version: '0.19'
resources:
- repository: http://github.com/Corion/test-without-module
-version: 0.18
+ license: http://dev.perl.org/licenses/
+ repository: git://github.com/Corion/test-without-module.git
+version: '0.19'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
+x_static_install: 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/Makefile.PL new/Test-Without-Module-0.19/Makefile.PL
--- old/Test-Without-Module-0.18/Makefile.PL 2014-08-30 15:28:56.000000000 +0200
+++ new/Test-Without-Module-0.19/Makefile.PL 2017-03-30 21:14:13.000000000 +0200
@@ -1,21 +1,49 @@
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-WriteMakefile1(
+
+# Normalize version strings like 6.30_02 to 6.3002,
+# so that we can do numerical comparisons on it.
+my $eumm_version = $ExtUtils::MakeMaker::VERSION;
+$eumm_version =~ s/_//;
+
+my $module = 'Test::Without::Module';
+(my $main_file = "lib/$module.pm") =~ s!::!/!g;
+(my $distname = $module) =~ s!::!-!g;
+my $content = do { local(*ARGV,$/)=[$main_file]; <> };
+(my $main_version)
+ = $content =~ m/ [^\n]* \$VERSION \s* = [^=] '([\d_.]+) [^\n]+ /gxms;
+
+my @tests = map {glob $_ } 't/*.t', 't/*/*.t';
+
+my %module = (
'NAME' => 'Test::Without::Module',
'VERSION_FROM' => 'lib/Test/Without/Module.pm', # finds $VERSION
'PREREQ_PM' => {
- # 'File::Slurp' => 0,
- # Only needed for testing
+ 'Carp' => 0,
}, # e.g., Module::Name => 1.1
- ($] >= 5.005 ? ## Add these new keywords supported since 5.005
- (ABSTRACT_FROM => 'lib/Test/Without/Module.pm', # retrieve abstract from module
- AUTHOR => 'Max Maischein ') : ()),
+ ABSTRACT_FROM => 'lib/Test/Without/Module.pm', # retrieve abstract from module
+ AUTHOR => 'Max Maischein ',
META_MERGE => {
+ "meta-spec" => { version => 2 },
resources => {
- repository => 'http://github.com/Corion/test-without-module',
+ repository => {
+ web => 'https://github.com/Corion/test-without-module',
+ url => 'git://github.com/Corion/test-without-module.git',
+ type => 'git',
+ },
+ bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=' . $distname,
+ license => 'http://dev.perl.org/licenses/',
},
+ dynamic_config => 0, # we promise to keep META.* up-to-date
+ x_static_install => 1, # we are pure Perl and don't do anything fancy
+ provides => {
+ $module => {
+ file => $main_file,
+ version => $main_version,
+ }
+ }
},
BUILD_REQUIRES => {
# Fairly long in core
@@ -25,15 +53,20 @@
},
# Make the version metadata explicit
- ($ExtUtils::MakeMaker::VERSION >= 6.3002 ?
- ('LICENSE' => 'perl', ) : ()),
-
+ 'LICENSE' => 'perl',
);
+sub get_module_info { %module }
+
+if ( ! caller ) {
+ regen_README($main_file);
+ #regen_EXAMPLES();
+ WriteMakefile1(get_module_info);
+}
+
sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
my %params=@_;
- my $eumm_version=$ExtUtils::MakeMaker::VERSION;
- $eumm_version=eval $eumm_version;
+
die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
die "License not specified" if not exists $params{LICENSE};
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
@@ -53,3 +86,27 @@
WriteMakefile(%params);
}
+sub regen_README {
+ eval {
+ require Pod::Readme;
+
+ my $parser = Pod::Readme->new();
+
+ # Read POD from Module.pm and write to README
+ $parser->parse_from_file($_[0], 'README');
+ };
+ eval {
+ require Pod::Markdown;
+
+ my $parser = Pod::Markdown->new();
+
+ # Read POD from Module.pm and write to README
+ $parser->parse_from_file($_[0]);
+ open my $fh, '>', 'README.mkdn'
+ or die "Couldn't open 'README.mkdn': $!";
+ print $fh $parser->as_markdown;
+ };
+}
+
+1;
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/README new/Test-Without-Module-0.19/README
--- old/Test-Without-Module-0.18/README 2003-03-09 13:27:38.000000000 +0100
+++ new/Test-Without-Module-0.19/README 2017-03-30 21:14:13.000000000 +0200
@@ -1,12 +1,90 @@
-Test/Without/Module version 0.03
-================================
+NAME
-INSTALLATION
+ Test::Without::Module - Test fallback behaviour in absence of modules
-To install this module type the following:
+SYNOPSIS
- perl Makefile.PL
- make
- make test
- make install
+ use Test::Without::Module qw( My::Module );
+
+ # Now, loading of My::Module fails :
+ eval { require My::Module; };
+ warn $@ if $@;
+
+ # Now it works again
+ eval q{ no Test::Without::Module qw( My::Module ) };
+ eval { require My::Module; };
+ print "Found My::Module" unless $@;
+
+DESCRIPTION
+
+ This module allows you to deliberately hide modules from a program even
+ though they are installed. This is mostly useful for testing modules
+ that have a fallback when a certain dependency module is not installed.
+
+ EXPORT
+
+ None. All magic is done via use Test::Without::Module LIST and no
+ Test::Without::Module LIST.
+
+ Test::Without::Module::get_forbidden_list
+
+ This function returns a reference to a copy of the current hash of
+ forbidden modules or an empty hash if none are currently forbidden.
+ This is convenient if you are testing and/or debugging this module.
+
+ONE LINER
+
+ A neat trick for using this module from the command line was mentioned
+ to me by NUFFIN and by Jerrad Pierce:
+
+ perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t
+
+ That way, you can easily see how your module or test file behaves when
+ a certain module is unavailable.
+
+BUGS
+
+ * There is no lexical scoping
+
+CREDITS
+
+ Much improvement must be thanked to Aristotle from PerlMonks, he
+ pointed me to a much less convoluted way to fake a module at
+ https://perlmonks.org?node=192635.
+
+ I also discussed with him an even more elegant way of overriding
+ CORE::GLOBAL::require, but the parsing of the overridden subroutine
+ didn't work out the way I wanted it - CORE::require didn't recognize
+ barewords as such anymore.
+
+ NUFFIN and Jerrad Pierce pointed out the convenient use from the
+ command line to interactively watch the behaviour of the test suite and
+ module in absence of a module.
+
+AUTHOR
+
+ Copyright (c) 2003-2014 Max Maischein,
+
+LICENSE
+
+ This module is released under the same terms as Perl itself.
+
+REPOSITORY
+
+ The public repository of this module is
+ https://github.com/Corion/test-without-module.
+
+SUPPORT
+
+ The public support forum of this module is https://perlmonks.org/.
+
+BUG TRACKER
+
+ Please report bugs in this module via the RT CPAN bug queue at
+ https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Without-Module
+ or via mail to test-without-module-Bugs@rt.cpan.org.
+
+SEE ALSO
+
+ Devel::Hide, Acme::Intraweb, PAR, perlfunc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/README.mkdn new/Test-Without-Module-0.19/README.mkdn
--- old/Test-Without-Module-0.18/README.mkdn 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Without-Module-0.19/README.mkdn 2017-03-30 21:14:13.000000000 +0200
@@ -0,0 +1,91 @@
+# NAME
+
+Test::Without::Module - Test fallback behaviour in absence of modules
+
+# SYNOPSIS
+
+ use Test::Without::Module qw( My::Module );
+
+ # Now, loading of My::Module fails :
+ eval { require My::Module; };
+ warn $@ if $@;
+
+ # Now it works again
+ eval q{ no Test::Without::Module qw( My::Module ) };
+ eval { require My::Module; };
+ print "Found My::Module" unless $@;
+
+# DESCRIPTION
+
+This module allows you to deliberately hide modules from a program
+even though they are installed. This is mostly useful for testing modules
+that have a fallback when a certain dependency module is not installed.
+
+## EXPORT
+
+None. All magic is done via `use Test::Without::Module LIST` and
+`no Test::Without::Module LIST`.
+
+## Test::Without::Module::get\_forbidden\_list
+
+This function returns a reference to a copy of the current hash of forbidden
+modules or an empty hash if none are currently forbidden. This is convenient
+if you are testing and/or debugging this module.
+
+# ONE LINER
+
+A neat trick for using this module from the command line
+was mentioned to me by NUFFIN and by Jerrad Pierce:
+
+ perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t
+
+That way, you can easily see how your module or test file behaves
+when a certain module is unavailable.
+
+# BUGS
+
+- There is no lexical scoping
+
+# CREDITS
+
+Much improvement must be thanked to Aristotle from PerlMonks, he pointed me
+to a much less convoluted way to fake a module at
+[https://perlmonks.org?node=192635](https://perlmonks.org?node=192635).
+
+I also discussed with him an even more elegant way of overriding
+CORE::GLOBAL::require, but the parsing of the overridden subroutine
+didn't work out the way I wanted it - CORE::require didn't recognize
+barewords as such anymore.
+
+NUFFIN and Jerrad Pierce pointed out the convenient
+use from the command line to interactively watch the
+behaviour of the test suite and module in absence
+of a module.
+
+# AUTHOR
+
+Copyright (c) 2003-2014 Max Maischein,
+
+# LICENSE
+
+This module is released under the same terms as Perl itself.
+
+# REPOSITORY
+
+The public repository of this module is
+[https://github.com/Corion/test-without-module](https://github.com/Corion/test-without-module).
+
+# SUPPORT
+
+The public support forum of this module is
+[https://perlmonks.org/](https://perlmonks.org/).
+
+# BUG TRACKER
+
+Please report bugs in this module via the RT CPAN bug queue at
+[https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Without-Module](https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Without-Module)
+or via mail to [test-without-module-Bugs@rt.cpan.org](https://metacpan.org/pod/test-without-module-Bugs@rt.cpan.org).
+
+# SEE ALSO
+
+[Devel::Hide](https://metacpan.org/pod/Devel::Hide), [Acme::Intraweb](https://metacpan.org/pod/Acme::Intraweb), [PAR](https://metacpan.org/pod/PAR), [perlfunc](https://metacpan.org/pod/perlfunc)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/lib/Test/Without/Module.pm new/Test-Without-Module-0.19/lib/Test/Without/Module.pm
--- old/Test-Without-Module-0.18/lib/Test/Without/Module.pm 2014-08-30 15:29:49.000000000 +0200
+++ new/Test-Without-Module-0.19/lib/Test/Without/Module.pm 2017-03-30 21:14:13.000000000 +0200
@@ -3,9 +3,9 @@
use Carp qw( croak );
use vars qw( $VERSION );
-$VERSION = '0.18';
+$VERSION = '0.19';
-use vars qw( %forbidden %fake_modules );
+use vars qw(%forbidden);
sub get_forbidden_list {
\%forbidden
@@ -17,8 +17,8 @@
my $forbidden = get_forbidden_list;
for (@forbidden_modules) {
- $forbidden->{$_} = $INC{ module2file($_) };
- $fake_modules{module2file($_)} = [ "package $_;", "0;" ];
+ my $file = module2file($_);
+ $forbidden->{$file} = delete $INC{$file};
};
# Scrub %INC, so that loaded modules disappear
@@ -33,10 +33,9 @@
my ($self,$module_file,$member_only) = @_;
# Don't touch $@, or .al files will not load anymore????
- # Deliver a faked, nonworking module
- if (my $faked = $fake_modules{$module_file}) {
- my @faked_module = @$faked;
- return sub { defined ( $_ = shift @faked_module ) };
+ if (exists get_forbidden_list->{$module_file}) {
+ my $module_name = file2module($module_file);
+ croak "Can't locate $module_file in \@INC (you may need to install the $module_name module) (\@INC contains: @INC)";
};
};
@@ -46,10 +45,9 @@
my $forbidden = get_forbidden_list;
for $module (@list) {
- if (exists $forbidden->{$module}) {
- my $file = module2file($module);
- delete $fake_modules{$file};
- my $path = delete $forbidden->{$module};
+ my $file = module2file($module);
+ if (exists $forbidden->{$file}) {
+ my $path = delete $forbidden->{$file};
if (defined $path) {
$INC{ $file } = $path;
}
@@ -167,7 +165,7 @@
=head1 REPOSITORY
The public repository of this module is
-Lhttp://github.com/Corion/test-without-module.
+Lhttps://github.com/Corion/test-without-module.
=head1 SUPPORT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/t/02-block-use-module.t new/Test-Without-Module-0.19/t/02-block-use-module.t
--- old/Test-Without-Module-0.18/t/02-block-use-module.t 2003-03-09 13:27:38.000000000 +0100
+++ new/Test-Without-Module-0.19/t/02-block-use-module.t 2017-03-30 21:14:13.000000000 +0200
@@ -5,7 +5,7 @@
BEGIN{ use_ok( "Test::Without::Module", qw( Digest::MD5 )); };
-is_deeply( [sort keys %{Test::Without::Module::get_forbidden_list()}],[ qw[ Digest::MD5 ]],"Module list" );
+is_deeply( [sort keys %{Test::Without::Module::get_forbidden_list()}],[ qw[ Digest/MD5.pm ]],"Module list" );
eval q{ use Digest::MD5 };
ok( $@ ne '', 'Importing raises an error' );
like( $@, qr!^(Can't locate Digest/MD5.pm in \@INC|Digest/MD5.pm did not return a true value at)!, "Hid module");
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/t/03-block-require-module.t new/Test-Without-Module-0.19/t/03-block-require-module.t
--- old/Test-Without-Module-0.18/t/03-block-require-module.t 2003-03-09 13:27:38.000000000 +0100
+++ new/Test-Without-Module-0.19/t/03-block-require-module.t 2017-03-30 21:14:13.000000000 +0200
@@ -12,7 +12,7 @@
use Test::Without::Module qw( Digest::MD5 );
ok( $@ ne '', "Loading raised error");
like( $@, qr!^(Can't locate Digest/MD5.pm in \@INC|Digest/MD5.pm did not return a true value at)!, "Hid module");
- is_deeply( [sort keys %{Test::Without::Module::get_forbidden_list()}],[ qw[ Digest::MD5 ]],"Module list" );
+ is_deeply( [sort keys %{Test::Without::Module::get_forbidden_list()}],[ qw[ Digest/MD5.pm ]],"Module list" );
delete_package( 'Digest::MD5' );
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Without-Module-0.18/t/06-missing-hidden-modules.t new/Test-Without-Module-0.19/t/06-missing-hidden-modules.t
--- old/Test-Without-Module-0.18/t/06-missing-hidden-modules.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Without-Module-0.19/t/06-missing-hidden-modules.t 2017-03-30 21:13:47.000000000 +0200
@@ -0,0 +1,32 @@
+
+use Test::Without::Module;
+use Test::More tests => 5;
+
+sub tryload {
+ my $module = shift;
+ my $failed = !eval "require $module; 1";
+ my $error = $@;
+ $error =~ s/(\(\@INC contains: ).*\)/$1...)/;
+ $error =~ s/\n+\z//;
+ my $inc_status = !exists $INC{"$module.pm"} ? 'missing'
+ : !defined $INC{"$module.pm"} ? 'undef'
+ : !$INC{"$module.pm"} ? 'false'
+ : '"'.$INC{"$module.pm"}.'"'
+ ;
+ return $failed, $error, $inc_status;
+}
+
+my ($failed,$error,$inc) = tryload( 'Nonexisting::Module' );
+is $failed, 1, "Self-test, a non-existing module fails to load";
+like $error, qr!^Can't locate Nonexisting/Module.pm in \@INC( \(you may need to install the Nonexisting::Module module\))? \(\@INC contains: ...\) line (\d+).!,
+ 'Self-test, error message shows @INC';
+#diag $error;
+
+# Now, hide a module that has not been loaded:
+ok !$INC{'IO/Socket.pm'}, "Module 'IO/Socket.pm' has not been loaded yet";
+Test::Without::Module->import('IO::Socket');
+
+($failed,$error,$inc) = tryload( 'IO::Socket' );
+is $failed, 1, "a non-existing module fails to load";
+like $error, qr!Can't locate IO/Socket.pm in \@INC( \(you may need to install the IO::Socket module\))? \(\@INC contains: ...\) line (\d+).!, 'error message for hidden module shows @INC';
+#diag $error;
\ No newline at end of file
++++++ cpanspec.yml ++++++
---
#description_paragraphs: 3
#description: |-
# override description from CPAN
#summary: override summary from CPAN
#no_testing: broken upstream
#sources:
# - source1
# - source2
#patches:
# foo.patch: -p1
# bar.patch:
#preamble: |-
# BuildRequires: gcc-c++
#post_prep: |-
# hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'`
# sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL
#post_build: |-
# rm unused.files
#post_install: |-
# sed on %{name}.files
#license: SUSE-NonFree
#skip_noarch: 1
#custom_build: |-
#./Build build flags=%{?_smp_mflags} --myflag
#custom_test: |-
#startserver && make test
#ignore_requires: Bizarre::Module