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/LoadClass.pm | |
parent | 7df1338f58d10c01cf8f742832b57b2736dbf301 (diff) | |
download | reply-3e19fb26f62ce9fa02e417c015f6668989d1eaad.tar.gz reply-3e19fb26f62ce9fa02e417c015f6668989d1eaad.zip |
convert all of the plugins
Diffstat (limited to 'lib/Reply/Plugin/LoadClass.pm')
-rw-r--r-- | lib/Reply/Plugin/LoadClass.pm | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/Reply/Plugin/LoadClass.pm b/lib/Reply/Plugin/LoadClass.pm index a225cdd..cbffb02 100644 --- a/lib/Reply/Plugin/LoadClass.pm +++ b/lib/Reply/Plugin/LoadClass.pm @@ -1,9 +1,9 @@ -package Reply::Plugin::LoadClass; +package main; use strict; use warnings; # ABSTRACT: attempts to load classes implicitly if possible -use base 'Reply::Plugin'; +use mop; use Module::Runtime 'use_package_optimistically'; use Try::Tiny; @@ -23,20 +23,19 @@ be loaded implicitly. =cut -sub execute { - my $self = shift; - my ($next, @args) = @_; - - try { - $next->(@args); - } - catch { - if (/^Can't locate object method "[^"]*" via package "([^"]*)"/) { - use_package_optimistically($1); +class Reply::Plugin::LoadClass extends Reply::Plugin { + method execute ($next, @args) { + try { $next->(@args); } - else { - die $_; + catch { + if (/^Can't locate object method "[^"]*" via package "([^"]*)"/) { + use_package_optimistically($1); + $next->(@args); + } + else { + die $_; + } } } } |