Moose/Role/NeedsPluginEvent.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 19 CC 1 SCAR 6.9
CC
1
Cov
0%
fire_plugin_event
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Padre::Plugin::Moose::Role::NeedsPluginEvent;
2 use Moose::Role;
3  
4 requires 'on_save_as';
5 requires 'new_document_from_string';
6  
7 sub fire_plugin_event {
8 my $orig = shift;
9 my $self = shift;
10  
11 # Save the return value
12 my $result = $self->$orig(@_);
13  
14 # Fire event that Padre does not implement at the moment
15 $self->{ide}->plugin_manager->plugin_event('editor_changed');
16  
17 # And return the original result
18 return $result;
19 }
20  
21 # Hook up to new_document_from_string
22 around 'new_document_from_string' => \&fire_plugin_event;
23  
24 # Hook up to on_save_as
25 around 'on_save_as' => \&fire_plugin_event;
26  
27 no Moose::Role;
28 1;