Skip Menu |

This queue is for tickets about the MooseX-Role-Parameterized CPAN distribution.

Report information
The Basics
Id: 88593
Status: resolved
Priority: 0/
Queue: MooseX-Role-Parameterized

People
Owner: Nobody in particular
Requestors: abraxxa [...] cpan.org
KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.01
Fixed in: (no value)



Subject: t/019-custom-metaclass.t fails under Perl 5.18.1
t/018-parameter-roles.t ............. skipped: Not implemented yet Can't locate Parameterized.pm in @INC (you may need to install the Parameterized module) (@INC contains: /home/abraxxa/.cpanplus/5.18.1/build/MooseX-Role-Parameterized-1.01/inc /home/abraxxa/.cpanplus/5.18.1/build/MooseX-Role-Parameterized-1.01/blib/lib /home/abraxxa/.cpanplus/5.18.1/build/MooseX-Role-Parameterized-1.01/blib/arch /home/abraxxa/perl5/perlbrew/perls/18/lib/site_perl/5.18.1/x86_64-linux-thread-multi /home/abraxxa/perl5/perlbrew/perls/18/lib/site_perl/5.18.1 /home/abraxxa/perl5/perlbrew/perls/18/lib/5.18.1/x86_64-linux-thread-multi /home/abraxxa/perl5/perlbrew/perls/18/lib/5.18.1 .) at /home/abraxxa/perl5/perlbrew/perls/18/lib/site_perl/5.18.1/Module/Runtime.pm line 317. t/019-custom-metaclass.t ............ Dubious, test returned 2 (wstat 512, 0x200) No subtests run t/020-metaclass-reinitialize.t ...... ok This is a fresh install of Perl 5.18.1 -Dusethreads -Duserelocateableinc with all CPAN modules updated. Version 1.00 succeeds all tests.
Running the tests with Carp::Always shows the cause:

in MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm:

generate_role() is calling

Module::Runtime::use_module("Parameterized")

and its as a result of

     my $parameterized_role_metaclass = $self->parameterized_role_metaclass;

returning that string.

Its weird, because if you dump the hash directly, it has a different value from what you get after calling the accessor, as if the name is being shortened by a coercion

Injecting these 2 lines
    pp({           direct => $self->{parameterized_role_metaclass} });
    pp({           method => $self->parameterized_role_metaclass   });

after this:

        unless $self->has_role_generator;

Emits this curiosity:

{
  direct => "MooseX::Role::Parameterized::Meta::Role::Parameterized",
}
{ method => "Parameterized" }


The difference for which I find unfathomably confusing.



Subject: carp_always_trace.txt
{} Can't locate Parameterized.pm in @INC (you may need to install the Parameterized module) (@INC contains: lib/ /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/x86_64-linux /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3 /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/5.19.3/x86_64-linux /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/5.19.3 .) at /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/Module/Runtime.pm line 317. Module::Runtime::require_module("Parameterized") called at /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/Module/Runtime.pm line 348 Module::Runtime::use_module("Parameterized") called at lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm line 61 MooseX::Role::Parameterized::Meta::Role::Parameterizable::generate_role(Parameterizable=HASH(0x3008908), "consumer", Moose::Meta::Class=HASH(0x302f4b8), "parameters", HASH(0x3004080)) called at lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm line 107 MooseX::Role::Parameterized::Meta::Role::Parameterizable::apply(Parameterizable=HASH(0x3008908), Moose::Meta::Class=HASH(0x302f4b8)) called at /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/x86_64-linux/Moose/Util.pm line 160 Moose::Util::_apply_all_roles(Moose::Meta::Class=HASH(0x302f4b8), undef, "MyRole") called at /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/x86_64-linux/Moose/Util.pm line 99 Moose::Util::apply_all_roles(Moose::Meta::Class=HASH(0x302f4b8), "MyRole") called at /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/x86_64-linux/Moose.pm line 66 Moose::with(Moose::Meta::Class=HASH(0x302f4b8), "MyRole") called at /home/kent/perl5/perlbrew/perls/perl-5.19.3/lib/site_perl/5.19.3/x86_64-linux/Moose/Exporter.pm line 409 Moose::with("MyRole") called at t/019-custom-metaclass.t line 42
On Tue Sep 10 20:46:20 2013, KENTNL wrote: Show quoted text
> Running the tests with Carp::Always shows the cause: > > in MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm: > > generate_role() is calling > > Module::Runtime::use_module("Parameterized") > > and its as a result of > > my $parameterized_role_metaclass = $self-
> >parameterized_role_metaclass;
> > returning that string. > > Its weird, because if you dump the hash directly, it has a different > value from > what you get after calling the accessor, as if the name is being > shortened by a > coercion > > Injecting these 2 lines > pp({ direct => $self->{parameterized_role_metaclass} }); > pp({ method => $self->parameterized_role_metaclass }); > > after this: > > unless $self->has_role_generator; > > Emits this curiosity: > > { > direct => "MooseX::Role::Parameterized::Meta::Role::Parameterized", > } > { method => "Parameterized" } > > > The difference for which I find unfathomably confusing.
019-custom-metaclass.t has this: do { package Parameterizable; use Moose; extends 'MooseX::Role::Parameterized::Meta::Role::Parameterizable'; sub parameterized_role_metaclass { 'Parameterized' } }; It’s not even reading the object’s hash entry.
Subject: Re: [rt.cpan.org #88593] t/019-custom-metaclass.t fails under Perl 5.18.1
Date: Wed, 11 Sep 2013 14:23:37 +0100
To: bug-MooseX-Role-Parameterized [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
The bug is that the change from version 1.00 to 1.01 of MX-R-P directly replaces a use of Class::MOP::load_class() with Module::Runtime::use_module() despite the functions having somewhat different behaviour. load_class() is defined to heuristically determine whether a class is already defined, whereas use_module() uses standard module loading semantics. The test fails because the "Parameterized" class is defined within the test script, not as a distinct module. I think MX-R-P should continue to use load_class(). Accessing load_class() through Class::MOP is deprecated: the preferred location is Class::Load. load_class() actually uses use_module() internally, after it's heuristically determined that a class is not yet defined. -zefram
Subject: Re: [rt.cpan.org #88593] t/019-custom-metaclass.t fails under Perl 5.18.1
Date: Wed, 11 Sep 2013 14:58:29 +0100
To: bug-MooseX-Role-Parameterized [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
Attached patch switches back to load_class(). -zefram

Message body is not shown because sender requested not to inline it.

I'd prefer not to switch back to Class::Load since the more robust Module::Runtime appeals to me. The fix I made, as suggested by kentfrederic in https://github.com/sartak/MooseX-Role-Parameterized/pull/7 , was to simply set up additional %INC entries in that test file. This change is only required with Moose before version 2.1100, since that version starts setting %INC for classes it sees, which avoids this flavor of runtime loading issue. So this fix mirrors that change nicely. Will be shipping 1.02 shortly. Thanks everybody!