Athanasius has asked for the wisdom of the Perl Monks concerning the following question:
Background. I’ve started using Strawberry Perl 5.22.0, and I’m trying to install tobyink’s useful P5U module. It has various dependencies, one of which fails to install: Module::Info, which fails 2/7 tests, 11/121 subtests. From the CPAN Testers Matrix it appears that Module::Info has failed almost universally across all platforms since Perl version 5.21.2. But are these failures serious or trivial? I decided to investigate.
Many of the failures are traceable to the Subroutine B::OP::parent redefined warning which appears to be a known problem. The tests fail in two test modules:
It is the single test failure in the second of these modules that is currently puzzling me.
The problem. The subtest which fails in t/n1_modules.t is this:
is_deeply( [ sort keys %mods ], [ sort qw(Cwd strict Carp) ], "Got the correct modules" );
It fails as follows:
# Failed test (t\n1_modules_required.t at line 17) # Structures begin differing at: # $got->[2] = 'Win32' # $expected->[2] = 'strict' # Looks like you failed 1 tests of 3. t\n1_modules_required.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/3 subtests
This failing subtest is supposed to verify that the 3 listed modules are used or required by the test module t/lib/Bar.pm. Here are the full contents of that module:
package Bar; use Cwd; use Cwd 1; use Cwd 1.00102; use Cwd 1.1.2; BEGIN { cwd(); } BEGIN { $x = 1; $x = 2; require strict; } sub my_croak { require Carp; Carp::croak(cwd, @_); } 1;
It has 24 lines. I have used a hex editor to confirm that there is nothing extra “lurking” in the file — WYSIWYG. Note that there is no mention of the Win32 module in Bar.pm.
The labyrinth. The route taken by the chain of subroutine calls from the failing test back to the source of the discrepency is a tortuous one (for ease of reading I have replaced the full paths with ellipses):
The failing subtest on line 14 of t/n1_modules_required.t compares a list of modules found against a list of expected modules. Since these are the modules used or required by t/lib/Bar.pm, the expected modules are (naturally) Cwd, strict, and Carp. The modules are found via the following calls:
my $bar = Module::Info->new_from_module( 'Bar' ); ... my %mods = $bar->modules_required;
Module::Info->new_from_module calls Module::Info->_find_all_installed, which returns this object:
bless({ dir => "...\\t\\lib", file => "...\\t\\lib\\Bar.pm", name => "Bar", safe => 0, use_version => 0, }, "Module::Info")
The call to Module::Info->modules_required gets a list of modules via the following call:
my @mods = $self->_call_B('modules_used');
_call_B in turn calls my($status, @out) = $self->_call_perl($command); with $command set to:
"-MO=Module::Info,modules_used" "...\t\lib\Bar.pm"
_call_perl calls @out = `$command 2>&1`; with $command set to:
...\perl\bin\perl.exe "-MO=Module::Info,modules_used" "...\t\lib\Bar. +pm"
The anomalies. Now, here’s where things get weird. First, we seem to have entered an infinite regression: modules_required calls _call_B, which calls _call_perl, which (apparently) calls modules_used. But modules_used calls modules_required, so we seem to be back where we started. But there is no infinite regression, so that can’t be what’s happening. Ok, so what does the call to:
...\perl\bin\perl.exe "-MO=Module::Info,modules_used" "...\t\lib\Bar. +pm"
actually do?
Second, that last call returns the following data:
Subroutine B::OP::parent redefined at ...\blib\lib/B/BUtils.pm line 21 +7. , use Cwd () at "...\t\lib\Bar.pm" line 3 , use Cwd (1) at "...\t\lib\Bar.pm" line 4 , use Cwd (1.00102) at "...\t\lib\Bar.pm" line 5 , use Cwd (v1.1.2) at "...\t\lib\Bar.pm" line 6 , use Win32 (0.27) at "...\t\lib\Bar.pm" line 624 , require bare strict.pm at line 15 , require bare Carp.pm at line 19 , ...\t\lib\Bar.pm syntax OK
Note that the Win32 module is reported as being used on line 624 of file Bar.pm. Not only does that file contain no mention of Win32; but it’s only 24 lines long! How does the call find an unmentioned module on a non-existent line of code?
I previously installed the same version (0.35) of Module::Info under Strawberry Perl 5.20.2, with no errors.
The questions. Can anyone shed any light on any of this? Suggest a way to carry the researches forward? Explain what happened between 5.20.2 and 5.22.0 to account for this bizarre behaviour? Assure me that force installing Module::Info will be safe?
Anyway, thanks for looking, :-)
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Installing Module::Info 0.35 for Strawberry Perl 5.22.0
by BrowserUk (Patriarch) on Jun 28, 2015 at 16:18 UTC | |
by Athanasius (Archbishop) on Jun 28, 2015 at 16:38 UTC | |
by BrowserUk (Patriarch) on Jun 28, 2015 at 17:50 UTC | |
by afoken (Chancellor) on Jun 28, 2015 at 18:44 UTC | |
by BrowserUk (Patriarch) on Jun 28, 2015 at 21:09 UTC | |
|
Re: Installing Module::Info 0.35 for Strawberry Perl 5.22.0
by syphilis (Archbishop) on Jun 29, 2015 at 00:07 UTC |