Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 124744
Status: rejected
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: Smylers [...] stripey.com
Cc:
AdminCc:

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



Subject: with requires pre-loading role module when using Function::Parameters and true
When applying a role, the docs suggest it isn't necessary to load the module containing it first. Yet for roles using both the true module and Function::Parameters, it does seem to be needed. $ perl -MMoo -MRoleWithMethod -E 'with q[RoleWithMethod]' $ perl -MMoo -E 'with q[RoleWithMethod]' RoleWithMethod.pm did not return a true value at /usr/local/share/perl/5.18.2/Module/Runtime.pm line 314. Using the attached RoleWithMethod.pm. It doesn't happen if methods are defined using Perl's built-in sub keyword, rather than Function::Parameter's method. So this might be a Function::Parameters bug; I've open Ticket #124743 for that case. But it isn't clear where the bug is, and since it actually happens at the point with is invoked, I'm reporting it here too. Cheers. Smylers
Subject: RoleWithMethod.pm
package RoleWithMethod; use Moo::Role; use true; use Function::Parameters; method blah() {}
Does this still happen if you omit 'use true'? If so, then IMO this is a case of "doctor, it hurts when I twist my arm into this strange position with this bizarre module that someone at some point thought might be a good idea..."
This is almost certainly not a problem in Moo, but something between Function::Parameters and true. It stops failing in perl 5.24. If I make slight adjustments to the call stack when calling Module::Runtime::require_module, it stops failing.
On Fri Mar 09 16:24:31 2018, ETHER wrote: Show quoted text
> Does this still happen if you omit 'use true'?
Sorry if my phrasing wasn't clear: I've only been able to tickle this bug when using all of Moo::Role, true, and Function::Parameters. Show quoted text
> If so, then IMO this is a case of "doctor, it hurts when I twist my arm into > this strange position with this bizarre module that someone at some point > thought might be a good idea..."
That well may be the case ... but that description could apply to any of the three modules in question, all of which warp the Perl language somewhat! true has been stable longer than t'other two modules have existed. On Fri Mar 09 16:58:14 2018, haarg wrote: Show quoted text
> This is almost certainly not a problem in Moo, but something between > Function::Parameters and true.
OK. Thanks for checking. (As an outsider, each pair of the three modules work just fine together, making it perpetually appear the problem is in whichever one you aren't looking at!) Show quoted text
> It stops failing in perl 5.24.
Ah, sorry for not thinking of reporting my Perl version, and thank you for working that out anyway. So maybe it's actually a perl bug, and not any of the three modules' ... Show quoted text
> If I make slight adjustments to the call stack when calling > Module::Runtime::require_module, it stops failing.
Are those adjustments the kind that could make it into a future release of Moo, thereby working round this bug (regardless of where the actual bug lies)? Or are they detrimental to other uses of Moo? Thanks. Smylers
On Sat Mar 10 02:54:13 2018, Smylers@stripey.com wrote: Show quoted text
> On Fri Mar 09 16:24:31 2018, ETHER wrote: >
> > Does this still happen if you omit 'use true'?
> > Sorry if my phrasing wasn't clear: I've only been able to tickle this > bug when using all of Moo::Role, true, and Function::Parameters. >
> > If so, then IMO this is a case of "doctor, it hurts when I twist my > > arm into > > this strange position with this bizarre module that someone at some > > point > > thought might be a good idea..."
> > That well may be the case ... but that description could apply to any > of the three modules in question, all of which warp the Perl language > somewhat! > > true has been stable longer than t'other two modules have existed. > > On Fri Mar 09 16:58:14 2018, haarg wrote: >
> > This is almost certainly not a problem in Moo, but something between > > Function::Parameters and true.
> > OK. Thanks for checking. > > (As an outsider, each pair of the three modules work just fine > together, making it perpetually appear the problem is in whichever one > you aren't looking at!)
Moo is doing nothing abnormal when loading these modules. It essentially boils down to a call to `require "RoleWithMethod.pm"`, with a couple levels of extra functions. true.pm appears to not be properly applying, or Function::Parameters is somehow removing its effect. Given that both of those are XS modules that modify the op tree, it's almost certainly a problem in one (or both) of them. Show quoted text
>
> > It stops failing in perl 5.24.
> > Ah, sorry for not thinking of reporting my Perl version, and thank you > for working that out anyway. So maybe it's actually a perl bug, and > not any of the three modules' ...
It may be a perl bug, but if it is it still may be reasonable for the modules to work around the issue. Show quoted text
>
> > If I make slight adjustments to the call stack when calling > > Module::Runtime::require_module, it stops failing.
> > Are those adjustments the kind that could make it into a future > release of Moo, thereby working round this bug (regardless of where > the actual bug lies)? Or are they detrimental to other uses of Moo?
There isn't any meaningful change I could put in place to prevent this. I've just observed that calling similar code that should have the same effect leads to different results. I can't reliably prevent the problem. Show quoted text
> > Thanks. > > Smylers
On Mon Mar 12 13:09:16 2018, haarg wrote: Show quoted text
> Moo is doing nothing abnormal when loading these modules. ... There isn't any meaningful > change I could put in place to prevent this.
Thanks for looking into this. I'll close this ticket then and hope that one of the other modules can be changed to avoid the issue. Cheers Smylers