summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-07-01 21:29:24 -0400
committerJesse Luehrs <doy@tozt.net>2013-07-01 21:29:24 -0400
commitdc7920a0e6cb26d24b1d943f42f47e1b115192b1 (patch)
treef3c9f9143997aaaa730256774410e205e2e20301
parenta5d47b1ad425985a3bb7b08532207e89110f9daa (diff)
downloadreply-dc7920a0e6cb26d24b1d943f42f47e1b115192b1.tar.gz
reply-dc7920a0e6cb26d24b1d943f42f47e1b115192b1.zip
handle inherited methods
-rw-r--r--dist.ini2
-rw-r--r--lib/Reply/Plugin/Autocomplete/Methods.pm23
2 files changed, 15 insertions, 10 deletions
diff --git a/dist.ini b/dist.ini
index 60c004d..df27ef6 100644
--- a/dist.ini
+++ b/dist.ini
@@ -29,6 +29,7 @@ skip = ^Proc::InvokeEditor$
skip = ^Win32::Console::ANSI$
skip = ^B::Keywords$
skip = ^Package::Stash$
+skip = ^MRO::Compat$
[Prereqs / RuntimeRecommends]
App::Nopaste = 0
@@ -39,6 +40,7 @@ Proc::InvokeEditor = 0
Term::ReadLine::Gnu = 0
B::Keywords = 0
Package::Stash = 0
+MRO::Compat = 0
; XXX it'd be nice if we could make this recommended instead of required
[OSPrereqs / MSWin32]
diff --git a/lib/Reply/Plugin/Autocomplete/Methods.pm b/lib/Reply/Plugin/Autocomplete/Methods.pm
index cd54d31..93fda29 100644
--- a/lib/Reply/Plugin/Autocomplete/Methods.pm
+++ b/lib/Reply/Plugin/Autocomplete/Methods.pm
@@ -5,6 +5,7 @@ use warnings;
use base 'Reply::Plugin';
+use MRO::Compat;
use Package::Stash;
use Scalar::Util 'blessed';
@@ -54,7 +55,7 @@ sub tab_handler {
$method = '' unless defined $method;
- my $package;
+ my $class;
if ($invocant =~ /^\$/) {
my $env = {
(map { %$_ } values %{ $self->{env} }),
@@ -62,23 +63,25 @@ sub tab_handler {
};
my $var = $env->{$invocant};
return unless $var && ref($var) eq 'REF' && blessed($$var);
- $package = blessed($$var);
+ $class = blessed($$var);
}
else {
- $package = $invocant;
+ $class = $invocant;
}
- my $stash = eval { Package::Stash->new($package) };
- return unless $stash;
-
my @results;
- for my $stash_method ($stash->list_all_symbols('CODE')) {
- next unless index($stash_method, $method) == 0;
+ for my $package (@{ mro::get_linear_isa($class) }) {
+ my $stash = eval { Package::Stash->new($package) };
+ next unless $stash;
+
+ for my $stash_method ($stash->list_all_symbols('CODE')) {
+ next unless index($stash_method, $method) == 0;
- push @results, $stash_method;
+ push @results, $stash_method;
+ }
}
- return @results;
+ return sort @results;
}
1;