summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/LoadClass.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply/Plugin/LoadClass.pm')
-rw-r--r--lib/Reply/Plugin/LoadClass.pm27
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 $_;
+ }
}
}
}