1 package Sepia
::ReadLine
;
8 sub rl_attempted_complete
10 my ($text, $line, $start, $end) = @_;
12 if (substr($line, 0, $start) =~ /^\s*$/ && $text =~ /^,(\S*)$/) {
14 @xs = map ",$_", grep /$x/, keys %Sepia::REPL
;
16 my ($type, $str) = (substr $line, $start && ($start-1), $end) =~ /^([\$\@\%\&]?)(.*)/;
17 my %h = qw(@ ARRAY % HASH & CODE * IO $ VARIABLE);
18 @xs = Sepia
::completions
$h{$type||'&'}, $str;
20 $TERM->completion_matches($text,
21 sub { $_[1] < @xs ?
$xs[$_[1]] : () });
26 { package main
; do $_ for @ARGV }
27 $TERM = new Term
::ReadLine
;
28 my $attr = $TERM->Attribs;
29 # $attr->{completion_entry_function} = \&rl_complete;
30 $attr->{attempted_completion_function
} = \
&rl_attempted_complete
;
31 $Sepia::READLINE
= sub { $TERM->readline(Sepia
::prompt
()) };