Devel-REPL
view release on metacpan or search on metacpan
lib/Devel/REPL/Plugin/Commands.pm view on Meta::CPAN
use strict;
use warnings;
package Devel::REPL::Plugin::Commands;
# ABSTRACT: Generic command creation plugin using injected functions
our $VERSION = '1.003029';
use Devel::REPL::Plugin;
use Scalar::Util qw(weaken);
use namespace::autoclean;
our $COMMAND_INSTALLER;
has 'command_set' => (
is => 'ro',
lazy => 1, default => sub { {} }
);
sub BEFORE_PLUGIN {
lib/Devel/REPL/Plugin/Commands.pm view on Meta::CPAN
}
}
sub AFTER_PLUGIN {
my ($self) = @_;
$self->setup_commands;
}
after 'setup_commands' => sub {
my ($self) = @_;
weaken($self);
$self->command_set->{load_plugin} = sub {
my $self = shift;
sub { $self->load_plugin(@_); };
};
};
sub command_installer {
my ($self) = @_;
my $command_set = $self->command_set;
my %command_subs = map {
lib/Devel/REPL/Plugin/Completion.pm view on Meta::CPAN
use strict;
use warnings;
package Devel::REPL::Plugin::Completion;
# ABSTRACT: Extensible tab completion
our $VERSION = '1.003029';
use Devel::REPL::Plugin;
use Scalar::Util 'weaken';
use PPI;
use namespace::autoclean;
has current_matches => (
is => 'rw',
isa => 'ArrayRef',
lazy => 1,
default => sub { [] },
);
lib/Devel/REPL/Plugin/Completion.pm view on Meta::CPAN
before 'read' => sub {
my ($self) = @_;
if ((!$self->term->isa("Term::ReadLine::Gnu") and !$self->term->isa("Term::ReadLine::Perl"))
and !$self->no_term_class_warning) {
warn "Term::ReadLine::Gnu or Term::ReadLine::Perl is required for the Completion plugin to work";
$self->no_term_class_warning(1);
}
my $weakself = $self;
weaken($weakself);
if ($self->term->isa("Term::ReadLine::Gnu")) {
$self->term->Attribs->{attempted_completion_function} = sub {
$weakself->_completion(@_);
};
}
if ($self->term->isa("Term::ReadLine::Perl")) {
$self->term->Attribs->{completion_function} = sub {
$weakself->_completion(@_);
( run in 0.869 second using v1.01-cache-2.11-cpan-65fba6d93b7 )