From 3e19fb26f62ce9fa02e417c015f6668989d1eaad Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 7 Aug 2013 22:28:04 -0400 Subject: convert all of the plugins --- lib/Reply/Plugin/LoadClass.pm | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'lib/Reply/Plugin/LoadClass.pm') 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 $_; + } } } } -- cgit v1.2.3-54-g00ecf