summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Autocomplete/Packages.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-08-07 22:28:04 -0400
committerJesse Luehrs <doy@tozt.net>2013-09-03 16:50:15 -0400
commit3e19fb26f62ce9fa02e417c015f6668989d1eaad (patch)
tree411f3292cf712606ad177b5229314eb739db4b7b /lib/Reply/Plugin/Autocomplete/Packages.pm
parent7df1338f58d10c01cf8f742832b57b2736dbf301 (diff)
downloadreply-3e19fb26f62ce9fa02e417c015f6668989d1eaad.tar.gz
reply-3e19fb26f62ce9fa02e417c015f6668989d1eaad.zip
convert all of the plugins
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Packages.pm')
-rw-r--r--lib/Reply/Plugin/Autocomplete/Packages.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Packages.pm b/lib/Reply/Plugin/Autocomplete/Packages.pm
index c2bb6a0..aaf3afc 100644
--- a/lib/Reply/Plugin/Autocomplete/Packages.pm
+++ b/lib/Reply/Plugin/Autocomplete/Packages.pm
@@ -1,9 +1,9 @@
-package Reply::Plugin::Autocomplete::Packages;
+package main;
use strict;
use warnings;
# ABSTRACT: tab completion for package names
-use base 'Reply::Plugin';
+use mop;
use Module::Runtime '$module_name_rx';
@@ -22,18 +22,18 @@ code.
=cut
-sub tab_handler {
- my $self = shift;
- my ($line) = @_;
+class Reply::Plugin::Autocomplete::Packages extends Reply::Plugin {
+ method tab_handler ($line) {
- # $module_name_rx does not permit trailing ::
- my ($before, $package_fragment) = $line =~ /(.*?)(${module_name_rx}:?:?)$/;
- return unless $package_fragment;
- return if $before =~ /^#/; # command
- return if $before =~ /->\s*$/; # method call
- return if $before =~ /[\$\@\%\&\*]\s*$/;
+ # $module_name_rx does not permit trailing ::
+ my ($before, $package_fragment) = $line =~ /(.*?)(${module_name_rx}:?:?)$/;
+ return unless $package_fragment;
+ return if $before =~ /^#/; # command
+ return if $before =~ /->\s*$/; # method call
+ return if $before =~ /[\$\@\%\&\*]\s*$/;
- return sort grep { index($_, $package_fragment) == 0 } all_packages();
+ return sort grep { index($_, $package_fragment) == 0 } all_packages();
+ }
}
1;