From 413f0da5b5bfced6ceb04cbf704e195feeb13c96 Mon Sep 17 00:00:00 2001 From: Sean O'Rourke Date: Sun, 2 May 2010 20:17:03 -0600 Subject: [PATCH] Only install completion on GNU readline. --- lib/Sepia/ReadLine.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Sepia/ReadLine.pm b/lib/Sepia/ReadLine.pm index c532b65..e71b21b 100644 --- a/lib/Sepia/ReadLine.pm +++ b/lib/Sepia/ReadLine.pm @@ -24,9 +24,13 @@ sub rl_attempted_complete sub repl { { package main; do $_ for @ARGV } - $TERM = new Term::ReadLine; - my $attr = $TERM->Attribs; - $attr->{attempted_completion_function} = \&rl_attempted_complete; + $TERM = new Term::ReadLine $0; + if (Term::ReadLine->ReadLine =~ /Gnu/) { + my $attr = $TERM->Attribs; + $attr->{attempted_completion_function} = \&rl_attempted_complete; + } else { + warn "Sepia::ReadLine: No completion without GNU Readline.\n"; + } $Sepia::READLINE = sub { $TERM->readline(Sepia::prompt()) }; goto &Sepia::repl; } -- 2.11.4.GIT