Subject: | make_from_mouse() does not work for multi-word namespaces. |
make_from_mouse() generates a file that is not usable. I have attached
the result of
perl -MMousse::Maker -we
'Mousse::Maker::make_from_mouse("Test::Builder2::Mouse")'
When loaded, there is an error:
Can't locate Test/Builder2/Mouse/Meta/Method/Constructor.pm in @INC
(@INC contains: lib
/Users/schwern/perl5/perlbrew/perls/perl-v5.12.2/lib/site_perl/5.12.2/darwin-thread-multi-2level
/Users/schwern/perl5/perlbrew/perls/perl-v5.12.2/lib/site_perl/5.12.2
/Users/schwern/perl5/perlbrew/perls/perl-v5.12.2/lib/5.12.2/darwin-thread-multi-2level
/Users/schwern/perl5/perlbrew/perls/perl-v5.12.2/lib/5.12.2 .) at
lib/Test/Builder2/Mouse.pm line 306.
BEGIN failed--compilation aborted at lib/Test/Builder2/Mouse.pm line 306.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
This stems from an improperly converted set of %INC statements at the
top of the file. Here is an example:
$INC{'Test::Builder2::Mouse.pm'} = __FILE__;
That should be:
$INC{'Test/Builder2/Mouse.pm'} = __FILE__;
A similar problem is at lines 1114, 3995 and 4002.
require 'Test::Builder2::Mouse/PurePerl.pm';
To do the replacement properly, instances of m{Mouse\.pm} or m{Mouse/}
should be replaced with "Test/Builder2/Mouse.pm" and
"Test/Builder2/Mouse/" respectively.
Here is the set of replacements I use for Test::Builder2's custom
eat_mouse script which works well. You should be able to adapt it.
https://github.com/schwern/test-more/blob/Test-Builder2/dist/eat_mouse
s{Mouse.pm}{Test/Builder2/Mouse.pm}g
s{Mouse/}{Test/Builder2/Mouse/}g
s{Mouse::}{Test::Builder2::Mouse::}g
# Special case for "use Mouse ()
s{use Mouse }{use Test::Builder2::Mouse }g
# Special case for 'Mouse' and 'Mouse::Foo'
s{(['"])(Mouse[:\w+]*)\1}{$1Test::Builder2::$2$1}g
# Special case for "package Mouse;"
s{package Mouse;}{package Test::Builder2::Mouse;}g;
The Mousse tests work because it only converts it to a single word
package. They should try a multi-word package such as Chocolate::Mousse.
Subject: | Mouse.pm |
Message body is not shown because it is too large.