Plugin interface:
Any my tests share the _make_fake_plugin sub:sub load_plugin { my $class = "My::Plugin::$_[0]"; eval "use $class" return $class->new }
Naturally there's quite a few checks in load_plugin which I'm not showing (and the role). Those are what I'm actually testing.package Emtpy; use Moose; package main; sub _make_fake_plugin { my $class = "My::Plugin::$_[0]"; $INC{"My/Plugin/$_[0].pm"} = 1; Moose::Meta::Class->create( $class => ( methods => { run => sub { push @FAKE_PLUGIN_LOG, \@_ } }, superclasses => [ qw<Empty> ], roles => [ qw<My::Plugin> ], ), ); }
What I'm really curious about, is the need for the Empty package. If I substitute the Empty for Moose directly I get the error:
I stole this syntax from the Moose::Meta::Class tests, (the doc is a bit thin) but I don't understand it. Can anyone explain why this is needed? Is there a cleaner way?Can't locate object method "class_precedence_list" via package "Class: +:MOP::Package"
In reply to Moose::Meta::Class needs a package? by Boldra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |