When I define my packages right inside a script (like for testing), Moose inheritance breaks down:
#!/usr/bin/perl use strict; use Test::More tests => 2; my $one = new Foo::Child; ok($one->can('foo'), "extends"); #fails my $two = new Foo::App; ok($two->can('foo'), "isa"); #succeeds package Foo; { use Moose; sub foo{}; 1; } { package Foo::Child; use Moose; extends qw/Foo/; 1; } { package Foo::App; use Moose; use base qw/Foo/; 1; } I posted a month or more ago about a similar behavior with Roles. Karen suggested I check that I use braces properly to localize namespaces. I didn't have time to do that at the time, but did now, trying all the obvious things. Moving packages into a separate file solves the problem. :-) Didn't do it!