Commit | Line | Data |
1716b200 |
1 | use strict; |
2 | use warnings; |
4d33251a |
3 | package Devel::REPL::Meta::Plugin; |
4 | |
5 | use Moose; |
1d6c2dbc |
6 | use namespace::autoclean; |
4d33251a |
7 | |
8 | extends 'Moose::Meta::Role'; |
9 | |
10 | before 'apply' => sub { |
11 | my ($self, $other) = @_; |
036068ec |
12 | return unless $other->isa('Devel::REPL'); |
4d33251a |
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) = @_; |
036068ec |
20 | return unless $other->isa('Devel::REPL'); |
4d33251a |
21 | if (my $pre = $self->get_method('AFTER_PLUGIN')) { |
22 | $pre->body->($other, $self); |
23 | } |
24 | }; |
25 | |
26 | 1; |