e08726ee8312e01c43c91ac8c29695ed35bc53ce
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Meta / Plugin.pm
1 use strict;
2 use warnings;
3 package Devel::REPL::Meta::Plugin;
4
5 use Moose;
6 use namespace::autoclean;
7
8 extends 'Moose::Meta::Role';
9
10 before 'apply' => sub {
11   my ($self, $other) = @_;
12   return unless $other->isa('Devel::REPL');
13   if (my $pre = $self->get_method('BEFORE_PLUGIN')) {
14     $pre->body->($other, $self);
15   }
16 };
17
18 after 'apply' => sub {
19   my ($self, $other) = @_;
20   return unless $other->isa('Devel::REPL');
21   if (my $pre = $self->get_method('AFTER_PLUGIN')) {
22     $pre->body->($other, $self);
23   }
24 };
25
26 1;