Subject: | Strange compile errors when consuming Moops roles from Moose |
Date: | Mon, 25 Nov 2013 16:58:44 +0000 |
To: | bug-Moops [...] rt.cpan.org |
From: | Piers Cawley <pdcawley [...] bofh.org.uk> |
It turns out that consuming a Moops role from plain old Moose is
surprisingly tricky.
Suppose I have:
use Moops;
role Example using Moose {
method foo { 'bar' }
}
then, when I write:
perl -E 'package Consumer; use Moose; with 'Example'; package main; say
Consumer->new->foo'
compilation blows up complaining that I can only consume roles, and Example
is not a moose role.
However, when I do:
perl -MExample -E '...'
All is well. As it is when I do:
perl -E 'use Example; package Consumer; ...'
and even (this one surprised me)
perl -E 'require Example; package Consumer; ...'
But, if I do:
perl -E 'package Consumer; use Example; ...'
we're back to blowing up with the same error.
I'm seeing this with perl 5.18.1, Moose 2.1005, Moops 0.26, Kavorka 0.019,
Keyword::Simple 0.02, Module::Runtime 0.013 if that's of any use.
Sorry this bug doesn't come with a .t file, but I couldn't work out how to
write one to express the issues correctly.