Here's something weird that I can't figure out. I have a Moose class that I also want to export some constants, using the age-old standard Exporter module. However, as soon as I add extends Exporter
to my class, for some reason, the default Moose constructor no longer gets inherited and I get the fatal error:
Can't locate object method "new" via package "MyApp::Dispatch"
Here is a simple test which demonstrates the problem.
package Foo;
use Moose;
use constant NARF => 'poit';
extends 'Exporter';
1;
$ perl -I./lib -MFoo -e '$f=Foo->new'
Can't locate object method "new" via package "Foo" at -e line 1.
Removing the extends
line makes the problem vanish.
This is using Moose 0.93.