diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-08-07 22:28:04 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-09-03 16:50:15 -0400 |
commit | 3e19fb26f62ce9fa02e417c015f6668989d1eaad (patch) | |
tree | 411f3292cf712606ad177b5229314eb739db4b7b /lib/Reply/Plugin/AutoRefresh.pm | |
parent | 7df1338f58d10c01cf8f742832b57b2736dbf301 (diff) | |
download | reply-3e19fb26f62ce9fa02e417c015f6668989d1eaad.tar.gz reply-3e19fb26f62ce9fa02e417c015f6668989d1eaad.zip |
convert all of the plugins
Diffstat (limited to 'lib/Reply/Plugin/AutoRefresh.pm')
-rw-r--r-- | lib/Reply/Plugin/AutoRefresh.pm | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/lib/Reply/Plugin/AutoRefresh.pm b/lib/Reply/Plugin/AutoRefresh.pm index 3a21dfb..28daac5 100644 --- a/lib/Reply/Plugin/AutoRefresh.pm +++ b/lib/Reply/Plugin/AutoRefresh.pm @@ -1,9 +1,10 @@ -package Reply::Plugin::AutoRefresh; +package main; use strict; use warnings; # ABSTRACT: automatically refreshes the external code you use -use base 'Reply::Plugin'; +use mop; + use Class::Refresh 0.05 (); =head1 SYNOPSIS @@ -28,31 +29,25 @@ modules correctly see the global override. =cut -sub new { - my $class = shift; - my %opts = @_; - - $opts{track_require} = 1 - unless defined $opts{track_require}; - - Class::Refresh->import(track_require => $opts{track_require}); - - # so that when we load things after this plugin, they get a copy of - # Module::Runtime which has the call to require() rebound to our overridden - # copy. if this plugin is loaded first, these should be the only - # modules loaded so far which load arbitrary user-specified modules. - Class::Refresh->refresh_module('Module::Runtime'); - Class::Refresh->refresh_module('base'); - - return $class->SUPER::new(@_); -} - -sub compile { - my $self = shift; - my ($next, @args) = @_; - - Class::Refresh->refresh; - $next->(@args); +class Reply::Plugin::AutoRefresh extends Reply::Plugin { + has $track_require = 1; + + submethod BUILD { + Class::Refresh->import(track_require => $track_require); + + # so that when we load things after this plugin, they get a copy of + # Module::Runtime which has the call to require() rebound to our + # overridden copy. if this plugin is loaded first, these should be the + # only modules loaded so far which load arbitrary user-specified + # modules. + Class::Refresh->refresh_module('Module::Runtime'); + Class::Refresh->refresh_module('base'); + } + + method compile ($next, @args) { + Class::Refresh->refresh; + $next->(@args); + } } 1; |