summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Autocomplete/Methods.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Methods.pm')
-rw-r--r--lib/Reply/Plugin/Autocomplete/Methods.pm23
1 files changed, 13 insertions, 10 deletions
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;