X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FTurtles.pm;h=ba26705f6537190f7170e000afc3ba6b8373a3cd;hb=28b7103538e1b830808da8d064dd5930db815610;hp=8bcba92644507b6f0d045e882c6e3d7d3c319e93;hpb=e22aa835df762f888ec7ff9efb2a599ebe17538e;p=p5sagit%2FDevel-REPL.git diff --git a/lib/Devel/REPL/Plugin/Turtles.pm b/lib/Devel/REPL/Plugin/Turtles.pm index 8bcba92..ba26705 100644 --- a/lib/Devel/REPL/Plugin/Turtles.pm +++ b/lib/Devel/REPL/Plugin/Turtles.pm @@ -3,8 +3,6 @@ use Devel::REPL::Plugin; use Scalar::Util qw(reftype); -use MooseX::AttributeHelpers; - use namespace::clean -except => [ 'meta' ]; has default_command_prefix => ( @@ -17,9 +15,10 @@ has turtles_matchers => ( metaclass => "Collection::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', }, ); @@ -67,3 +66,26 @@ sub match_turtles { } 1; + +__END__ + +=head1 NAME + +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 +