diff options
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete')
-rw-r--r-- | lib/Reply/Plugin/Autocomplete/Lexicals.pm | 8 | ||||
-rw-r--r-- | lib/Reply/Plugin/Autocomplete/Methods.pm | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Lexicals.pm b/lib/Reply/Plugin/Autocomplete/Lexicals.pm index dd953bf..204778a 100644 --- a/lib/Reply/Plugin/Autocomplete/Lexicals.pm +++ b/lib/Reply/Plugin/Autocomplete/Lexicals.pm @@ -24,16 +24,16 @@ sub new { my $class = shift; my $self = $class->SUPER::new(@_); - $self->{env} = {}; + $self->{env} = []; return $self; } sub lexical_environment { my $self = shift; - my ($name, $env) = @_; + my ($env) = @_; - $self->{env}{$name} = $env; + push @{ $self->{env} }, $env; } sub tab_handler { @@ -48,7 +48,7 @@ sub tab_handler { # these can't be lexicals return if $sigil eq '&' || $sigil eq '*'; - my $env = { map { %$_ } values %{ $self->{env} } }; + my $env = { map { %$_ } @{ $self->{env} } }; my @env = keys %$env; my @results; diff --git a/lib/Reply/Plugin/Autocomplete/Methods.pm b/lib/Reply/Plugin/Autocomplete/Methods.pm index 151caa0..d4319b2 100644 --- a/lib/Reply/Plugin/Autocomplete/Methods.pm +++ b/lib/Reply/Plugin/Autocomplete/Methods.pm @@ -28,7 +28,7 @@ sub new { my $class = shift; my $self = $class->SUPER::new(@_); - $self->{env} = {}; + $self->{env} = []; $self->{package} = 'main'; return $self; @@ -36,9 +36,9 @@ sub new { sub lexical_environment { my $self = shift; - my ($name, $env) = @_; + my ($env) = @_; - $self->{env}{$name} = $env; + push @{ $self->{env} }, $env; } sub package { @@ -63,8 +63,7 @@ sub tab_handler { if ($invocant =~ /^\$/) { # XXX should support globals here my $env = { - (map { %$_ } values %{ $self->{env} }), - (%{ $self->{env}{defaults} || {} }), + map { %$_ } @{ $self->{env} }, }; my $var = $env->{$invocant}; return unless $var && ref($var) eq 'REF' && blessed($$var); |