| 1 | package WWW::MenuGrinder::Role::Plugin; | ||
| 2 | BEGIN { | ||
| 3 | $WWW::MenuGrinder::Role::Plugin::VERSION = '0.06'; | ||
| 4 | } | ||
| 5 | |||
| 6 | # ABSTRACT: WWW::MenuGrinder role for all plugins. | ||
| 7 | |||
| 8 | use Moose::Role; | ||
| 9 | |||
| 10 | has 'grinder' => ( | ||
| 11 | is => 'ro', | ||
| 12 | isa => 'WWW::MenuGrinder', | ||
| 13 | required => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | sub verify_plugin { | ||
| 17 | my ($self) = @_; | ||
| 18 | |||
| 19 | if ($self->can('plugin_required_grinder_methods')) { | ||
| 20 | my @methods = $self->plugin_required_grinder_methods; | ||
| 21 | for my $m (@methods) { | ||
| 22 | if (! $self->grinder->can($m)) { | ||
| 23 | die ref($self) . " requires method '$m' but " . ref($self->grinder) | ||
| 24 | . "doesn't provide it.\n"; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | no Moose::Role; | ||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | __END__ |