Hello community, here is the log from the commit of package perl-Module-Runtime for openSUSE:Factory checked in at 2014-02-28 19:15:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Module-Runtime (Old) and /work/SRC/openSUSE:Factory/.perl-Module-Runtime.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Module-Runtime" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Module-Runtime/perl-Module-Runtime.changes 2013-06-13 18:12:52.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Module-Runtime.new/perl-Module-Runtime.changes 2014-02-28 19:15:40.000000000 +0100 @@ -1,0 +2,23 @@ +Mon Feb 24 06:10:39 UTC 2014 - co...@suse.com + +- updated to 0.014 + * bugfix: suppress any CORE::GLOBAL::require override, where possible, + to avoid use_package_optimistically() being misled into treating + missing modules as broken + + * bugfix: in use_module() and use_package_optimistically(), pass a + supplied VERSION parameter through for the version check even if it + is undef + + * tighten use_package_optimistically()'s recognition of can't-locate + errors (the same way that base.pm has recently been tightened), + so that, when a module fails to load because a module that it uses + isn't available, the outer module will be perceived as broken rather + than missing + + * update documentation notes about the state of Unicode handling for + module names + + * in META.{yml,json}, point to public git repository + +------------------------------------------------------------------- Old: ---- Module-Runtime-0.013.tar.gz New: ---- Module-Runtime-0.014.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Module-Runtime.spec ++++++ --- /var/tmp/diff_new_pack.iQiejM/_old 2014-02-28 19:15:40.000000000 +0100 +++ /var/tmp/diff_new_pack.iQiejM/_new 2014-02-28 19:15:40.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Module-Runtime # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products 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,7 +17,7 @@ Name: perl-Module-Runtime -Version: 0.013 +Version: 0.014 Release: 0 %define cpan_name Module-Runtime Summary: runtime module handling @@ -30,7 +30,6 @@ BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Module::Build) -#BuildRequires: perl(Module::Runtime) %{perl_requires} %description @@ -43,7 +42,8 @@ that is used for barewords in Perl source. In principle this syntax can vary between versions of Perl, and this module applies the syntax of the Perl on which it is running. In practice the usable syntax hasn't changed -yet, but there's a good chance of it changing in Perl 5.18. +yet. There's some intent for Unicode module names to be supported in the +future, but this hasn't yet amounted to any consistent facility. The functions of this module whose purpose is to load modules include workarounds for three old Perl core bugs regarding 'require'. These ++++++ Module-Runtime-0.013.tar.gz -> Module-Runtime-0.014.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/Build.PL new/Module-Runtime-0.014/Build.PL --- old/Module-Runtime-0.013/Build.PL 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/Build.PL 2014-02-06 23:09:32.000000000 +0100 @@ -25,6 +25,12 @@ }, dynamic_config => 0, meta_add => { distribution_type => "module" }, + meta_merge => { + resources => { + repository => + "git://git.fysh.org/zefram/Module-Runtime.git", + }, + }, create_makefile_pl => "passthrough", sign => 1, )->create_build_script; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/Changes new/Module-Runtime-0.014/Changes --- old/Module-Runtime-0.013/Changes 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/Changes 2014-02-06 23:09:32.000000000 +0100 @@ -1,3 +1,24 @@ +version 0.014; 2014-02-06 + + * bugfix: suppress any CORE::GLOBAL::require override, where possible, + to avoid use_package_optimistically() being misled into treating + missing modules as broken + + * bugfix: in use_module() and use_package_optimistically(), pass a + supplied VERSION parameter through for the version check even if it + is undef + + * tighten use_package_optimistically()'s recognition of can't-locate + errors (the same way that base.pm has recently been tightened), + so that, when a module fails to load because a module that it uses + isn't available, the outer module will be perceived as broken rather + than missing + + * update documentation notes about the state of Unicode handling for + module names + + * in META.{yml,json}, point to public git repository + version 0.013; 2012-02-16 * fix false failure of the test for lack of unintended dependencies diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/MANIFEST new/Module-Runtime-0.014/MANIFEST --- old/Module-Runtime-0.013/MANIFEST 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/MANIFEST 2014-02-06 23:09:32.000000000 +0100 @@ -11,6 +11,8 @@ t/Context.pm t/Eval.pm t/Hints.pm +t/Nest0.pm +t/Nest1.pm t/Simple.pm t/cmn.t t/dependency.t @@ -24,4 +26,5 @@ t/taint.t t/um.t t/upo.t +t/upo_overridden.t SIGNATURE Added here by Module::Build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/META.json new/Module-Runtime-0.014/META.json --- old/Module-Runtime-0.013/META.json 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/META.json 2014-02-06 23:09:32.000000000 +0100 @@ -4,7 +4,7 @@ "Andrew Main (Zefram) <zef...@fysh.org>" ], "dynamic_config" : 0, - "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.112621", + "generated_by" : "Module::Build version 0.4204", "license" : [ "perl_5" ], @@ -16,19 +16,19 @@ "prereqs" : { "build" : { "requires" : { - "Module::Build" : 0, - "Test::More" : 0, + "Module::Build" : "0", + "Test::More" : "0", "perl" : "5.006", - "strict" : 0, - "warnings" : 0 + "strict" : "0", + "warnings" : "0" } }, "configure" : { "requires" : { - "Module::Build" : 0, + "Module::Build" : "0", "perl" : "5.006", - "strict" : 0, - "warnings" : 0 + "strict" : "0", + "warnings" : "0" } }, "runtime" : { @@ -40,14 +40,17 @@ "provides" : { "Module::Runtime" : { "file" : "lib/Module/Runtime.pm", - "version" : "0.013" + "version" : "0.014" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" - ] + ], + "repository" : { + "url" : "git://git.fysh.org/zefram/Module-Runtime.git" + } }, - "version" : "0.013" + "version" : "0.014" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/META.yml new/Module-Runtime-0.014/META.yml --- old/Module-Runtime-0.013/META.yml 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/META.yml 2014-02-06 23:09:32.000000000 +0100 @@ -14,7 +14,7 @@ strict: 0 warnings: 0 dynamic_config: 0 -generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.112621' +generated_by: 'Module::Build version 0.4204, CPAN::Meta::Converter version 2.131560' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -23,9 +23,10 @@ provides: Module::Runtime: file: lib/Module/Runtime.pm - version: 0.013 + version: 0.014 requires: perl: 5.006 resources: license: http://dev.perl.org/licenses/ -version: 0.013 + repository: git://git.fysh.org/zefram/Module-Runtime.git +version: 0.014 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/Makefile.PL new/Module-Runtime-0.014/Makefile.PL --- old/Module-Runtime-0.013/Makefile.PL 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/Makefile.PL 2014-02-06 23:09:32.000000000 +0100 @@ -1,4 +1,4 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.3800 +# Note: this file was auto-generated by Module::Build::Compat version 0.4204 require 5.006; unless (eval "use Module::Build::Compat 0.02; 1" ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/README new/Module-Runtime-0.014/README --- old/Module-Runtime-0.013/README 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/README 2014-02-06 23:09:32.000000000 +0100 @@ -9,11 +9,12 @@ avoids using any other modules, so that it can be used in low-level infrastructure. -The parts of this module that work with module names apply the same -syntax that is used for barewords in Perl source. In principle this -syntax can vary between versions of Perl, and this module applies the -syntax of the Perl on which it is running. In practice the usable syntax -hasn't changed yet, but there's a good chance of it changing in Perl 5.18. +The parts of this module that work with module names apply the same syntax +that is used for barewords in Perl source. In principle this syntax +can vary between versions of Perl, and this module applies the syntax of +the Perl on which it is running. In practice the usable syntax hasn't +changed yet. There's some intent for Unicode module names to be supported +in the future, but this hasn't yet amounted to any consistent facility. The functions of this module whose purpose is to load modules include workarounds for three old Perl core bugs regarding "require". These @@ -34,7 +35,7 @@ COPYRIGHT -Copyright (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012 +Copyright (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012, 2014 Andrew Main (Zefram) <zef...@fysh.org> LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/SIGNATURE new/Module-Runtime-0.014/SIGNATURE --- old/Module-Runtime-0.013/SIGNATURE 2012-02-16 21:11:39.000000000 +0100 +++ new/Module-Runtime-0.014/SIGNATURE 2014-02-06 23:09:40.000000000 +0100 @@ -1,5 +1,5 @@ This file contains message digests of all files listed in MANIFEST, -signed via the Module::Signature module, version 0.68. +signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: @@ -15,18 +15,20 @@ Hash: SHA1 SHA1 846abd52ddad1c3141b395933fd10f14cb3cd7bc .gitignore -SHA1 dd0ddabd6469a1b8c7f9dd0e7eb63a59d9b763db Build.PL -SHA1 1786bb673326c135b8536eff943dfe4a3e850bd2 Changes -SHA1 7761501f07e9045a073537d0cce2e4214d417abd MANIFEST -SHA1 3268c4149dbf6e3c930fa56ef931e7e9ccd52acb META.json -SHA1 240b429caf419dcf15c6d45f9c0db68601167601 META.yml -SHA1 a4df8e97ccd390a42212af5a9f4d0986c85e7a5f Makefile.PL -SHA1 5601c747fdb2c85a790ebfe21303f693f9e38574 README -SHA1 320784cdadccf5e4c6e364a5d0abfabc77bda9f9 lib/Module/Runtime.pm +SHA1 550af94fde243fb4333061a2a7b03f274a6fb33f Build.PL +SHA1 132345e83b6e7293e7e011f5bb0f7fd9dcaf59ae Changes +SHA1 0f537563bf9b875501217c236e970f78ed04788b MANIFEST +SHA1 a8a5bf1ea3b6d09579aeb5930c721b7b817914a6 META.json +SHA1 0f7e531061b47d38c3962ab7dd2433c1ad062b28 META.yml +SHA1 0cfc7cc7e89b6334cf739d85244af8854a08b45d Makefile.PL +SHA1 35948979e61ed7586ffa28049ab3043232478473 README +SHA1 5d69c254f3af9104dcbe82c55a0260bbf81d2492 lib/Module/Runtime.pm SHA1 e80e49f06f99a5b5bb0faf54988df29a7aff89c5 t/Break.pm SHA1 c3c7b101e683f9f3d7f915763aa6d1850421bcb4 t/Context.pm SHA1 fbe32c46e3fe2cac40e4ab173764aec7db9b2a00 t/Eval.pm SHA1 d7f5ca01199b601b1a1a86127270d9ab7d1ca50b t/Hints.pm +SHA1 ffe7d868943d2340608382f87281098e5dd7b951 t/Nest0.pm +SHA1 e8bdcdde82209336e6c1f0123c283ec839d0efcb t/Nest1.pm SHA1 f8988828e7cab17800a0b5f25547f09431933480 t/Simple.pm SHA1 a0f9c0dfbe6472e81222a196a2f17554697d0d48 t/cmn.t SHA1 7324434239bc0678904a4eb406f6c3b08951b162 t/dependency.t @@ -38,12 +40,13 @@ SHA1 65c75abdef6f01a5d1588a307f2ddfe2333dc961 t/pod_syn.t SHA1 2e9638c32424e2e58100d64cb74ac50a0b964d1b t/rm.t SHA1 5a0ef5f7a982fbaff5d501165ae2720f465c7560 t/taint.t -SHA1 75d8504e7dc405bc5b7296b509bcfad5230477c0 t/um.t -SHA1 4aed128da5418fa7b5f3ff21d89fc3134bc5a111 t/upo.t +SHA1 a57c7214dbd32d1dd814b30e45ac9dc3eaeebf4d t/um.t +SHA1 ddba26fbb70f1ac345b16b79098f96e36e812835 t/upo.t +SHA1 58c31b3e89d117d674da19600ce8d3967ecaaa6a t/upo_overridden.t -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.10 (GNU/Linux) +Version: GnuPG v1.4.12 (GNU/Linux) -iEYEARECAAYFAk89YvYACgkQOV9mt2VyAVHHawCfW+ymYhHx+1tmD6WZR4fRZeyu -3UIAn2MaTRkCYt8M/VdRijw+wZvq13UL -=7k4S +iEYEARECAAYFAlL0CBwACgkQOV9mt2VyAVGAVACeOdEFo68kefBCRGYWXBoaC+a7 +eR8AnRO4eNYgF0t/ig68L/m5syrSkzCZ +=OmNr -----END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/lib/Module/Runtime.pm new/Module-Runtime-0.014/lib/Module/Runtime.pm --- old/Module-Runtime-0.013/lib/Module/Runtime.pm 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/lib/Module/Runtime.pm 2014-02-06 23:09:32.000000000 +0100 @@ -42,11 +42,12 @@ avoids using any other modules, so that it can be used in low-level infrastructure. -The parts of this module that work with module names apply the same -syntax that is used for barewords in Perl source. In principle this -syntax can vary between versions of Perl, and this module applies the -syntax of the Perl on which it is running. In practice the usable syntax -hasn't changed yet, but there's a good chance of it changing in Perl 5.18. +The parts of this module that work with module names apply the same syntax +that is used for barewords in Perl source. In principle this syntax +can vary between versions of Perl, and this module applies the syntax of +the Perl on which it is running. In practice the usable syntax hasn't +changed yet. There's some intent for Unicode module names to be supported +in the future, but this hasn't yet amounted to any consistent facility. The functions of this module whose purpose is to load modules include workarounds for three old Perl core bugs regarding C<require>. These @@ -57,7 +58,7 @@ =head2 Module name syntax The usable module name syntax has not changed from Perl 5.000 up to -Perl 5.15.7. The syntax is composed entirely of ASCII characters. +Perl 5.19.8. The syntax is composed entirely of ASCII characters. From Perl 5.6 onwards there has been some attempt to allow the use of non-ASCII Unicode characters in Perl source, but it was fundamentally broken (like the entirety of Perl 5.6's Unicode handling) and remained @@ -66,7 +67,6 @@ parser in some places, it remains broken for module names. Furthermore, there has not yet been any work on how to map Unicode module names into filenames, so in that respect also Unicode module names are unusable. -This may finally be addressed in the Perl 5.17 series. The module name syntax is, precisely: the string must consist of one or more segments separated by C<::>; each segment must consist of one or more @@ -120,7 +120,7 @@ BEGIN { ${^WARNING_BITS} = ""; } # Don't "use strict" here, to avoid dependencies. -our $VERSION = "0.013"; +our $VERSION = "0.014"; # Don't use Exporter here, to avoid dependencies. our @EXPORT_OK = qw( @@ -310,11 +310,11 @@ my $notional_filename = &module_notional_filename; my $guard = bless([ $notional_filename ], "Module::Runtime::__GUARD__"); - my $result = require($notional_filename); + my $result = CORE::require($notional_filename); pop @$guard; return $result; } else { - return scalar(require(&module_notional_filename)); + return scalar(CORE::require(&module_notional_filename)); } } @@ -346,9 +346,7 @@ sub use_module($;$) { my($name, $version) = @_; require_module($name); - if(defined $version) { - $name->VERSION($version); - } + $name->VERSION($version) if @_ >= 2; return $name; } @@ -366,8 +364,8 @@ This is mostly the same operation that is performed by the L<base> pragma to ensure that the specified base classes are available. The behaviour -of L<base> was simplified in version 2.18, and this function changed -to match. +of L<base> was simplified in version 2.18, and later improved in version +2.20, and on both occasions this function changed to match. If a I<VERSION> is specified, the C<VERSION> method of the loaded package is called with the specified I<VERSION> as an argument. This normally serves @@ -379,11 +377,13 @@ sub use_package_optimistically($;$) { my($name, $version) = @_; - check_module_name($name); + my $fn = module_notional_filename($name); eval { local $SIG{__DIE__}; require_module($name); }; die $@ if $@ ne "" && - $@ !~ /\ACan't locate .+ at \Q@{[__FILE__]}\E line/s; - $name->VERSION($version) if defined $version; + ($@ !~ /\ACan't locate \Q$fn\E .+ at \Q@{[__FILE__]}\E line/s || + $@ =~ /^Compilation\ failed\ in\ require + \ at\ \Q@{[__FILE__]}\E\ line/xm); + $name->VERSION($version) if @_ >= 2; return $name; } @@ -468,6 +468,17 @@ =back +=head1 BUGS + +On Perl versions 5.7.2 to 5.8.8, if C<require> is overridden by the +C<CORE::GLOBAL> mechanism, it is likely to break the heuristics used by +L</use_package_optimistically>, making it signal an error for a missing +module rather than assume that it was already loaded. From Perl 5.8.9 +onwards, and on 5.7.1 and earlier, this module can avoid being confused +by such an override. On the affected versions, a C<require> override +might be installed by L<Lexical::SealRequireHints>, if something requires +its bugfix but for some reason its XS implementation isn't available. + =head1 SEE ALSO L<Lexical::SealRequireHints>, @@ -481,7 +492,7 @@ =head1 COPYRIGHT -Copyright (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012 +Copyright (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012, 2014 Andrew Main (Zefram) <zef...@fysh.org> =head1 LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/t/Nest0.pm new/Module-Runtime-0.014/t/Nest0.pm --- old/Module-Runtime-0.013/t/Nest0.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Module-Runtime-0.014/t/Nest0.pm 2014-02-06 23:09:32.000000000 +0100 @@ -0,0 +1,10 @@ +package t::Nest0; + +{ use 5.006; } +use warnings; +use strict; +use t::Nested; + +our $VERSION = 1; + +"t::Nest0 return"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/t/Nest1.pm new/Module-Runtime-0.014/t/Nest1.pm --- old/Module-Runtime-0.013/t/Nest1.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Module-Runtime-0.014/t/Nest1.pm 2014-02-06 23:09:32.000000000 +0100 @@ -0,0 +1,12 @@ +package t::Nest1; + +{ use 5.006; } +use warnings; +use strict; +use Module::Runtime qw(require_module); + +our $VERSION = 1; + +require_module("t::Nested"); + +"t::Nest1 return"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/t/um.t new/Module-Runtime-0.014/t/um.t --- old/Module-Runtime-0.013/t/um.t 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/t/um.t 2014-02-06 23:09:32.000000000 +0100 @@ -1,39 +1,33 @@ use warnings; use strict; -use Test::More tests => 29; +use Test::More tests => 37; BEGIN { use_ok "Module::Runtime", qw(use_module); } -my($result, $err); - -sub test_use_module($;$) { - my($name, $version) = @_; - $result = eval { use_module($name, $version) }; - $err = $@; -} +my $result; # a module that doesn't exist -test_use_module("t::NotExist"); -like($err, qr/^Can't locate /); +$result = eval { use_module("t::NotExist") }; +like($@, qr/^Can't locate /); # a module that's already loaded -test_use_module("Test::More"); -is($err, ""); +$result = eval { use_module("Test::More") }; +is($@, ""); is($result, "Test::More"); # a module that we'll load now -test_use_module("t::Simple"); -is($err, ""); +$result = eval { use_module("t::Simple") }; +is($@, ""); is($result, "t::Simple"); # re-requiring the module that we just loaded -test_use_module("t::Simple"); -is($err, ""); +$result = eval { use_module("t::Simple") }; +is($@, ""); is($result, "t::Simple"); # module file scope sees scalar context regardless of calling context -eval { use_module("t::Context"); 1 }; +$result = eval { use_module("t::Context"); 1 }; is $@, ""; # lexical hints don't leak through @@ -84,12 +78,34 @@ } # successful version check -test_use_module("Module::Runtime", 0.001); -is($err, ""); +$result = eval { use_module("Module::Runtime", 0.001) }; +is($@, ""); is($result, "Module::Runtime"); # failing version check -test_use_module("Module::Runtime", 999); -like($err, qr/^Module::Runtime version /); +$result = eval { use_module("Module::Runtime", 999) }; +like($@, qr/^Module::Runtime version /); + +# make sure any version argument gets passed through +my @version_calls; +sub t::HasVersion::VERSION { + push @version_calls, [@_]; +} +$INC{"t/HasVersion.pm"} = 1; +eval { use_module("t::HasVersion") }; +is $@, ""; +is_deeply \@version_calls, []; +@version_calls = (); +eval { use_module("t::HasVersion", 2) }; +is $@, ""; +is_deeply \@version_calls, [["t::HasVersion",2]]; +@version_calls = (); +eval { use_module("t::HasVersion", "wibble") }; +is $@, ""; +is_deeply \@version_calls, [["t::HasVersion","wibble"]]; +@version_calls = (); +eval { use_module("t::HasVersion", undef) }; +is $@, ""; +is_deeply \@version_calls, [["t::HasVersion",undef]]; 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/t/upo.t new/Module-Runtime-0.014/t/upo.t --- old/Module-Runtime-0.013/t/upo.t 2012-02-16 21:11:34.000000000 +0100 +++ new/Module-Runtime-0.014/t/upo.t 2014-02-06 23:09:32.000000000 +0100 @@ -1,31 +1,25 @@ use warnings; use strict; -use Test::More tests => 30; +use Test::More tests => 42; BEGIN { use_ok "Module::Runtime", qw(use_package_optimistically); } -my($result, $err); - -sub test_use_package_optimistically($;$) { - my($name, $version) = @_; - $result = eval { use_package_optimistically($name, $version) }; - $err = $@; -} +my $result; # a module that doesn't exist -test_use_package_optimistically("t::NotExist"); -is $err, ""; +$result = eval { use_package_optimistically("t::NotExist") }; +is $@, ""; is $result, "t::NotExist"; # a module that's already loaded -test_use_package_optimistically("Test::More"); -is $err, ""; +$result = eval { use_package_optimistically("Test::More") }; +is $@, ""; is $result, "Test::More"; # a module that we'll load now -test_use_package_optimistically("t::Simple"); -is $err, ""; +$result = eval { use_package_optimistically("t::Simple") }; +is $@, ""; is $result, "t::Simple"; no strict "refs"; ok defined(${"t::Simple::VERSION"}); @@ -70,21 +64,57 @@ eval { use_package_optimistically("t::Break") }; like $@, qr/\A(?:broken |Attempt to reload )/; +# module broken by virtue of trying to non-optimistically load a +# non-existent module via "use" +eval { use_package_optimistically("t::Nest0") }; +like $@, qr/\ACan't locate /; +eval { use_package_optimistically("t::Nest0") }; +like $@, qr/\A(?:Can't locate |Attempt to reload )/; + +# module broken by virtue of trying to non-optimistically load a +# non-existent module via require_module() +eval { use_package_optimistically("t::Nest1") }; +like $@, qr/\ACan't locate /; +eval { use_package_optimistically("t::Nest1") }; +like $@, qr/\A(?:Can't locate |Attempt to reload )/; + # successful version check -test_use_package_optimistically("Module::Runtime", 0.001); -is $err, ""; +$result = eval { use_package_optimistically("Module::Runtime", 0.001) }; +is $@, ""; is $result, "Module::Runtime"; # failing version check -test_use_package_optimistically("Module::Runtime", 999); -like $err, qr/^Module::Runtime version /; +$result = eval { use_package_optimistically("Module::Runtime", 999) }; +like $@, qr/^Module::Runtime version /; # even load module if $VERSION already set, unlike older behaviour $t::Context::VERSION = undef; -test_use_package_optimistically("t::Context"); -is $err, ""; +$result = eval { use_package_optimistically("t::Context") }; +is $@, ""; is $result, "t::Context"; ok defined($t::Context::VERSION); ok $INC{"t/Context.pm"}; +# make sure any version argument gets passed through +my @version_calls; +sub t::HasVersion::VERSION { + push @version_calls, [@_]; +} +$INC{"t/HasVersion.pm"} = 1; +eval { use_package_optimistically("t::HasVersion") }; +is $@, ""; +is_deeply \@version_calls, []; +@version_calls = (); +eval { use_package_optimistically("t::HasVersion", 2) }; +is $@, ""; +is_deeply \@version_calls, [["t::HasVersion",2]]; +@version_calls = (); +eval { use_package_optimistically("t::HasVersion", "wibble") }; +is $@, ""; +is_deeply \@version_calls, [["t::HasVersion","wibble"]]; +@version_calls = (); +eval { use_package_optimistically("t::HasVersion", undef) }; +is $@, ""; +is_deeply \@version_calls, [["t::HasVersion",undef]]; + 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Runtime-0.013/t/upo_overridden.t new/Module-Runtime-0.014/t/upo_overridden.t --- old/Module-Runtime-0.013/t/upo_overridden.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Module-Runtime-0.014/t/upo_overridden.t 2014-02-06 23:09:32.000000000 +0100 @@ -0,0 +1,19 @@ +use warnings; +use strict; + +if("$]" < 5.007002) { + require Test::More; + Test::More::plan(skip_all => + "require override can't work acceptably on this perl"); +} elsif("$]" >= 5.007002 && "$]" < 5.008009) { + require Test::More; + Test::More::plan(skip_all => + "require override can't be dodged on this perl"); +} + +no warnings "once"; +*CORE::GLOBAL::require = sub { require $_[0] }; + +do "t/upo.t" or die $@ || $!; + +1; -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org