Commit | Line | Data |
1716b200 |
1 | use strict; |
2 | use warnings; |
4d33251a |
3 | package Devel::REPL::Meta::Plugin; |
4 | |
77327851 |
5 | our $VERSION = '1.003030'; |
54beb05d |
6 | |
4d33251a |
7 | use Moose; |
1d6c2dbc |
8 | use namespace::autoclean; |
4d33251a |
9 | |
10 | extends 'Moose::Meta::Role'; |
11 | |
12 | before 'apply' => sub { |
13 | my ($self, $other) = @_; |
036068ec |
14 | return unless $other->isa('Devel::REPL'); |
4d33251a |
15 | if (my $pre = $self->get_method('BEFORE_PLUGIN')) { |
16 | $pre->body->($other, $self); |
17 | } |
18 | }; |
19 | |
20 | after 'apply' => sub { |
21 | my ($self, $other) = @_; |
036068ec |
22 | return unless $other->isa('Devel::REPL'); |
4d33251a |
23 | if (my $pre = $self->get_method('AFTER_PLUGIN')) { |
24 | $pre->body->($other, $self); |
25 | } |
26 | }; |
27 | |
28 | 1; |