use Term::ReadLine;
use Moose;
-use namespace::clean;
+use namespace::clean -except => [ 'meta' ];
with 'MooseX::Object::Pluggable';
}
sub compile {
- my ($self, $line) = @_;
- my $compiled = eval $self->wrap_as_sub($line);
- return (undef, $self->error_return("Compile error", $@)) if $@;
+ my $REPL = shift;
+ my $compiled = eval $REPL->wrap_as_sub($_[0]);
+ return (undef, $REPL->error_return("Compile error", $@)) if $@;
return $compiled;
}
}
sub execute {
- my $REPL = shift;
- my @ret = eval { shift->(@_) };
- return $REPL->error_return("Runtime error", $@) if $@;
+ my ($self, $to_exec, @args) = @_;
+ my @ret = eval { $to_exec->(@args) };
+ return $self->error_return("Runtime error", $@) if $@;
return @ret;
}
package Devel::REPL::Plugin::History;
use Moose::Role;
+use namespace::clean -except => [ 'meta' ];
has 'history' => (
isa => 'ArrayRef', is => 'rw', required => 1, lazy => 1,
package Devel::REPL::Plugin::Turtles;
use Moose::Role;
+use namespace::clean -except => [ 'meta' ];
around 'eval' => sub {
my $next = shift;
my ($self, $line) = @_;
if ($line =~ /^#(.*)/) {
- return $next->($self, ('$self->' . $1 . '; return();'));
+ return $next->($self, ('$REPL->' . $1 . '; return();'));
}
else {
return $next->($self, $line);
};
-1;
\ No newline at end of file
+1;