From: nothingmuch Date: Mon, 5 May 2008 18:20:04 +0000 (+0000) Subject: print a warning when Completion is loaded but the Term::ReadLine object doesn't suppo... X-Git-Tag: v1.003015~129 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=97d28d6b74a5aa91b2af19a28c438caa193bfac0;p=p5sagit%2FDevel-REPL.git print a warning when Completion is loaded but the Term::ReadLine object doesn't support completion git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@4322 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/lib/Devel/REPL/Plugin/Completion.pm b/lib/Devel/REPL/Plugin/Completion.pm index e9ac902..126b81e 100644 --- a/lib/Devel/REPL/Plugin/Completion.pm +++ b/lib/Devel/REPL/Plugin/Completion.pm @@ -18,6 +18,12 @@ has match_index => ( default => sub { 0 }, ); +has no_term_class_warning => ( + isa => "Bool", + is => "rw", + default => 0, +); + sub BEFORE_PLUGIN { my ($self) = @_; @@ -29,6 +35,13 @@ sub BEFORE_PLUGIN { }; } +sub AFTER_PLUGIN { + my ($self) = @_; + + warn "Term::ReadLine::Gnu is required for the Completion plugin to work" + unless $self->term->isa("Term::ReadLine::Gnu") and !$self->no_term_class_warning; +} + sub _completion { my ($self, $text, $line, $start, $end) = @_;