+use strict;
+use warnings;
package Devel::REPL::Plugin::Turtles;
-use Devel::REPL::Plugin;
+use Devel::REPL::Plugin;
use Scalar::Util qw(reftype);
-
-use MooseX::AttributeHelpers;
-
-use namespace::clean -except => [ 'meta' ];
+use namespace::autoclean;
has default_command_prefix => (
isa => "RegexpRef",
);
has turtles_matchers => (
- metaclass => "Collection::Array",
+ traits => ['Array'],
isa => "ArrayRef[RegexpRef|CodeRef]",
is => "rw",
lazy => 1,
default => sub { my $prefix = shift->default_command_prefix; [qr/^ $prefix (\w+) \s* (.*) /x] },
- provides => {
- unshift => "add_turtles_matcher",
+ handles => {
+ add_turtles_matcher => 'unshift',
},
);
Devel::REPL::Plugin::Turtles - Generic command creation using a read hook
+=head1 DESCRIPTION
+
+By default, this plugin allows calling commands using a read hook
+to detect a default_command_prefix followed by the command name,
+say MYCMD as an example. The actual routine to call for the
+command is constructed by looking for subs named 'command_MYCMD'
+or 'expr_MYCMD' and executing them.
+
+=head2 NOTE
+
+The C<default_command_prefix> is C<qr/\#/> so care must be taken
+if other uses for that character are needed (e.g., '#' for the
+shell escape character in the PDL shell.
+
=cut