summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/ReadLine.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-06-27 18:21:59 -0400
committerJesse Luehrs <doy@tozt.net>2013-06-27 18:21:59 -0400
commit6bd057874f99aeb2c0d243880f3333a64d96045f (patch)
treecff8f85b8a3a784a582774b3ab9f160a74032c68 /lib/Reply/Plugin/ReadLine.pm
parentca1aa50a460e9a179168dfb211f3e32751f69bb7 (diff)
downloadreply-6bd057874f99aeb2c0d243880f3333a64d96045f.tar.gz
reply-6bd057874f99aeb2c0d243880f3333a64d96045f.zip
clean up the publisher stuff some more
Diffstat (limited to 'lib/Reply/Plugin/ReadLine.pm')
-rw-r--r--lib/Reply/Plugin/ReadLine.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Reply/Plugin/ReadLine.pm b/lib/Reply/Plugin/ReadLine.pm
index 757ea53..6465369 100644
--- a/lib/Reply/Plugin/ReadLine.pm
+++ b/lib/Reply/Plugin/ReadLine.pm
@@ -7,6 +7,7 @@ use base 'Reply::Plugin';
use File::HomeDir;
use File::Spec;
+use Scalar::Util 'weaken';
use Term::ReadLine;
=head1 SYNOPSIS
@@ -37,7 +38,6 @@ sub new {
my $self = $class->SUPER::new(@_);
$self->{term} = Term::ReadLine->new('Reply');
- $self->{publisher} = $opts{publisher};
my $history = $opts{history_file} || '.reply_history';
$self->{history_file} = File::Spec->catfile(
(File::Spec->file_name_is_absolute($history)
@@ -91,7 +91,8 @@ sub _register_tab_complete {
my $self = shift;
my $term = $self->{term};
- my $publisher = $self->{publisher};
+
+ weaken(my $weakself = $self);
if ($term->ReadLine eq 'Term::ReadLine::Gnu') {
$term->Attribs->{attempted_completion_function} = sub {
@@ -100,7 +101,7 @@ sub _register_tab_complete {
# discard everything after the cursor for completion purposes
substr($line, $end) = '';
- my @matches = $publisher->('tab_handler', $line);
+ my @matches = $weakself->publish('tab_handler', $line);
my $match_index = 0;
return $term->completion_matches($text, sub {