Readline interface: Difference between revisions

m
→‎{{header|Perl}}: future-proof for 5.36
m (syntax highlighting fixup automation)
m (→‎{{header|Perl}}: future-proof for 5.36)
Line 805:
use POSIX;
 
my $term = new Term::ReadLine->new( 'simple Perl shell' );
my $attribs = $term->Attribs;
$attribs->{completion_append_character} = ' ';
Line 819:
my $command = $term->readline('> ');
$term->addhistory($command) if $command;
return $command;
}
 
Line 831:
sub attempt_perl_completion {
my ($text, $line, $start, $end) = @_;
return $term->completion_matches($text, \&perl_symbol_completion_function);
}
 
Line 856:
return $entry if ($entry =~ /^\Q$text/);
}
return undef;
}</syntaxhighlight>
 
2,392

edits