/usr/share/perl5/Reply/Plugin/Autocomplete/Lexicals.pm is in libreply-perl 0.34-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | package Reply::Plugin::Autocomplete::Lexicals;
BEGIN {
$Reply::Plugin::Autocomplete::Lexicals::AUTHORITY = 'cpan:DOY';
}
{
$Reply::Plugin::Autocomplete::Lexicals::VERSION = '0.34';
}
use strict;
use warnings;
# ABSTRACT: tab completion for lexical variables
use base 'Reply::Plugin';
use Reply::Util qw($varname_rx);
sub tab_handler {
my $self = shift;
my ($line) = @_;
my ($var) = $line =~ /($varname_rx)$/;
return unless $var;
my ($sigil, $name_prefix) = $var =~ /(.)(.*)/;
# these can't be lexicals
return if $sigil eq '&' || $sigil eq '*';
my $env = { map { %$_ } $self->publish('lexical_environment') };
my @env = keys %$env;
my @results;
for my $env_var (@env) {
my ($env_sigil, $env_name) = $env_var =~ /(.)(.*)/;
next unless index($env_name, $name_prefix) == 0;
# this is weird, not sure why % gets stripped but not $ or @
if ($sigil eq $env_sigil) {
push @results, $sigil eq '%' ? $env_var : $env_name;
}
elsif ($env_sigil eq '@' && $sigil eq '$') {
push @results, "$env_name\[";
}
elsif ($env_sigil eq '%') {
push @results, "$env_name\{";
}
}
return @results;
}
1;
__END__
=pod
=head1 NAME
Reply::Plugin::Autocomplete::Lexicals - tab completion for lexical variables
=head1 VERSION
version 0.34
=head1 SYNOPSIS
; .replyrc
[ReadLine]
[Autocomplete::Lexicals]
=head1 DESCRIPTION
This plugin registers a tab key handler to autocomplete lexical variables in
Perl code.
=head1 AUTHOR
Jesse Luehrs <doy@tozt.net>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Jesse Luehrs.
This is free software, licensed under:
The MIT (X11) License
=cut
|