/usr/share/perl5/Sepia/ReadLine.pm is in sepia 0.992-6.
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 | package Sepia::ReadLine;
use Term::ReadLine;
use Sepia;
require Exporter;
@ISA='Exporter';
@EXPORT='repl';
sub rl_complete
{
my ($text, $line, $start) = @_;
my @xs;
if (substr($line, 0, $start) =~ /^\s*$/ && $text =~ /^,(\S*)$/) {
my $x = qr/^\Q$1\E/;
@xs = map ",$_", grep /$x/, keys %Sepia::REPL;
} else {
my ($type, $str) = (substr $line, $start ?(($start-1), length($text)+1)
: ($start, length($text)))
=~ /^([\$\@\%\&]?)(.*)/;
my %h = qw(@ ARRAY % HASH & CODE * IO $ VARIABLE);
@xs = Sepia::completions $h{$type||'&'}, $str;
}
@xs;
}
sub repl
{
{ package main; do $_ for @ARGV }
$TERM = new Term::ReadLine $0;
my $rl = Term::ReadLine->ReadLine;
if ($rl =~ /Gnu/) {
my $attr = $TERM->Attribs;
$attr->{completion_function} = \&rl_complete;
} elsif ($rl =~ /Perl/) {
$readline::rl_completion_function = \&rl_complete;
$readline::var_TcshCompleteMode = 1;
# XXX: probably helpful...
# } elsif (grep -x "$_/rlwrap", split ':', $ENV{PATH}) {
# warn "Sepia::ReadLine: Falling back to rlwrap.\n";
} else {
warn "Sepia::ReadLine: No completion with $rl.\n";
}
$Sepia::READLINE = sub { $TERM->readline(Sepia::prompt()) };
goto &Sepia::repl;
}
1;
|