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() {}