Commit | Line | Data |
4d33251a |
1 | package Devel::REPL::Meta::Plugin; |
2 | |
3 | use Moose; |
4 | |
5 | extends 'Moose::Meta::Role'; |
6 | |
7 | before 'apply' => sub { |
8 | my ($self, $other) = @_; |
036068ec |
9 | return unless $other->isa('Devel::REPL'); |
4d33251a |
10 | if (my $pre = $self->get_method('BEFORE_PLUGIN')) { |
11 | $pre->body->($other, $self); |
12 | } |
13 | }; |
14 | |
15 | after 'apply' => sub { |
16 | my ($self, $other) = @_; |
036068ec |
17 | return unless $other->isa('Devel::REPL'); |
4d33251a |
18 | if (my $pre = $self->get_method('AFTER_PLUGIN')) { |
19 | $pre->body->($other, $self); |
20 | } |
21 | }; |
22 | |
23 | 1; |