Skip Menu |

This queue is for tickets about the CatalystX-RoleApplicator CPAN distribution.

Report information
The Basics
Id: 70358
Status: rejected
Priority: 0/
Queue: CatalystX-RoleApplicator

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

Bug Information
Severity: Important
Broken in: 0.005
Fixed in: (no value)



Subject: 'Can't call method "does_role" on an undefined value' failures in test suite
The test suite fails under some circumstances with 'Can't call method "does_role" on an undefined value' - see the log below, and the test results reported at http://www.cpantesters.org/distro/C/CatalystX- RoleApplicator.html#CatalystX-RoleApplicator-0.005 mike@charron:~/.cpan/build/CatalystX-RoleApplicator-0.005-6h7pHs$ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for CatalystX::RoleApplicator Writing MYMETA.yml and MYMETA.json mike@charron:~/.cpan/build/CatalystX-RoleApplicator-0.005-6h7pHs$ make cp lib/CatalystX/RoleApplicator.pm blib/lib/CatalystX/RoleApplicator.pm Manifying blib/man3/CatalystX::RoleApplicator.3 mike@charron:~/.cpan/build/CatalystX-RoleApplicator-0.005-6h7pHs$ make test PERL_DL_NONLAZY=1 /home/mike/perl5/perlbrew/perls/perl- 5.14.1/bin/perl5.14.1 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_basic.t .. 1/5 Can't call method "does_role" on an undefined value at t/01_basic.t line 22. # Looks like you planned 5 tests but ran 3. # Looks like your test exited with 255 just after 3. t/01_basic.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 2/5 subtests Test Summary Report ------------------- t/01_basic.t (Wstat: 65280 Tests: 3 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 5 tests but ran 3. Files=1, Tests=3, 1 wallclock secs ( 0.02 usr 0.01 sys + 0.75 cusr 0.07 csys = 0.85 CPU) Result: FAIL Failed 1/1 test programs. 0/3 subtests failed. make: *** [test_dynamic] Error 255
The test for apply_engine_class_roles is the one that fails. It looks like it has failed since at least Catalyst 5.80033. The reason it fails is that when you apply a role to the engine_class, a new anonymous class is created and then Catalyst->engine_class($anon_class) is called, which passes $anon_class to Catalyst::EngineLoader, but the engine class is then expanded using Catalyst::EngineLoader->_guess_catalyst_engine_class which prepends Catalyst::Engine to the class name. Thus Catalyst->engine_class('Moose::Meta::Class::__ANON__::SERIAL::17') really sets the engine class to Catalyst::Engine::Moose::Meta::Class::__ANON__::SERIAL::17 which does not exist. I'm not sure what the best way to go about fixing this is, but I am attaching a patch here that will fix it, even if it may not be the best way.
Subject: 0001-Fix-engine_class-class-name.patch
From 94080bce13f9cc8e6766f8f9619b66881ca20068 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson <doug@somethingdoug.com> Date: Sun, 18 Sep 2011 23:28:07 -0400 Subject: [PATCH] Fix engine_class class name --- lib/CatalystX/RoleApplicator.pm | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/CatalystX/RoleApplicator.pm b/lib/CatalystX/RoleApplicator.pm index 7a424ad..981f903 100644 --- a/lib/CatalystX/RoleApplicator.pm +++ b/lib/CatalystX/RoleApplicator.pm @@ -25,6 +25,13 @@ sub init_meta { ->apply($meta, name => $_, require_class_accessor => 0); } + if (defined $meta->find_method_by_name('engine_loader2')) { + $meta->add_after_method_modifier('apply_engine_class_roles', sub { + my $engine_loader = shift->engine_loader; + $engine_loader->catalyst_engine_class($engine_loader->requested_engine); + }); + } + return $meta; } -- 1.7.6.msysgit.0
On Sun Sep 18 23:30:14 2011, DOUGDUDE wrote: Show quoted text
> The test for apply_engine_class_roles is the one that fails. It looks > like it has failed since at least Catalyst 5.80033. The reason it fails > is that when you apply a role to the engine_class, a new anonymous class > is created and then Catalyst->engine_class($anon_class) is called, which > passes $anon_class to Catalyst::EngineLoader, but the engine class is > then expanded using Catalyst::EngineLoader->_guess_catalyst_engine_class > which prepends Catalyst::Engine to the class name. > > Thus > > Catalyst->engine_class('Moose::Meta::Class::__ANON__::SERIAL::17') > really sets the engine class to > Catalyst::Engine::Moose::Meta::Class::__ANON__::SERIAL::17 which does > not exist. I'm not sure what the best way to go about fixing this is, > but I am attaching a patch here that will fix it, even if it may not be > the best way.
Sorry, the previous patch had a typo of "engine_loader2" (there shouldn't be a 2 there). Here is an updated patch.
Subject: 0002-Fix-engine_class-class-name.patch
From e0e6ba70dd290f24de48317f58ca6842e07f7c2a Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson <doug@somethingdoug.com> Date: Sun, 18 Sep 2011 23:28:07 -0400 Subject: [PATCH] Fix engine_class class name --- lib/CatalystX/RoleApplicator.pm | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/CatalystX/RoleApplicator.pm b/lib/CatalystX/RoleApplicator.pm index 7a424ad..46c53d2 100644 --- a/lib/CatalystX/RoleApplicator.pm +++ b/lib/CatalystX/RoleApplicator.pm @@ -25,6 +25,13 @@ sub init_meta { ->apply($meta, name => $_, require_class_accessor => 0); } + if (defined $meta->find_method_by_name('engine_loader')) { + $meta->add_after_method_modifier('apply_engine_class_roles', sub { + my $engine_loader = shift->engine_loader; + $engine_loader->catalyst_engine_class($engine_loader->requested_engine); + }); + } + return $meta; } -- 1.7.6.msysgit.0
This is a bug in Catalyst, and rafl has promised to fix it.