22f6b795ba417e4d1060b09ee914f4f22bd223a1
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Meta / Plugin.pm
1 use strict;
2 use warnings;
3 package Devel::REPL::Meta::Plugin;
4
5 our $VERSION = '1.003030';
6
7 use Moose;
8 use namespace::autoclean;
9
10 extends 'Moose::Meta::Role';
11
12 before 'apply' => sub {
13   my ($self, $other) = @_;
14   return unless $other->isa('Devel::REPL');
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) = @_;
22   return unless $other->isa('Devel::REPL');
23   if (my $pre = $self->get_method('AFTER_PLUGIN')) {
24     $pre->body->($other, $self);
25   }
26 };
27
28 1;