X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FTurtles.pm;h=a908c8f8c4a51e8e94bf24d78733728031d5ae56;hb=8d5343b5f1fb9e3b33d1d36e96aabc94e29a822b;hp=b53a3c15311c485ecdd751ae1a6f36ab93ba7c34;hpb=4ea2c25425ec86ef71282ea6f5a04f153e3648ed;p=p5sagit%2FDevel-REPL.git diff --git a/lib/Devel/REPL/Plugin/Turtles.pm b/lib/Devel/REPL/Plugin/Turtles.pm index b53a3c1..a908c8f 100644 --- a/lib/Devel/REPL/Plugin/Turtles.pm +++ b/lib/Devel/REPL/Plugin/Turtles.pm @@ -1,11 +1,10 @@ +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", @@ -14,13 +13,13 @@ has default_command_prefix => ( ); 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', }, ); @@ -75,5 +74,19 @@ __END__ 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 is C 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