From: Robin Edwards Date: Thu, 10 Dec 2009 16:44:05 +0000 (+0000) Subject: bit of a reshuffle X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=022ffac2b25cbed179d8ee6119d619a98763c65e;p=p5sagit%2FDevel-Declare-Keyword.git bit of a reshuffle --- diff --git a/examples/DDExample.pm b/examples/DDExample.pm index 80500d8..2dcf608 100644 --- a/examples/DDExample.pm +++ b/examples/DDExample.pm @@ -1,4 +1,4 @@ -package DevelDeclareExample; +package DDExample; use strict; use warnings; use Devel::Declare; @@ -17,7 +17,6 @@ sub import { ); no strict 'refs'; *{$caller.'::method'} = sub (&) {}; - use warnings; } our ($Declarator, $Offset); @@ -35,7 +34,7 @@ sub parser { if (defined $name) { $name = join('::', Devel::Declare::get_curstash_name(), $name) unless ($name =~ /::/); - shadow(sub (&) { no strict 'refs'; warn; *{$name} = shift; }); + shadow(sub (&) { no strict 'refs'; *{$name} = shift; }); } else { shadow(sub (&) { shift }); } @@ -113,7 +112,7 @@ sub inject_scope { sub scope_injector_call { - return ' BEGIN { DevelDeclareExample::inject_scope() }; '; + return ' BEGIN { DDExample::inject_scope() }; '; } sub shadow { diff --git a/examples/Methods.pm b/examples/Methods.pm index 2f79e7a..4ce0817 100644 --- a/examples/Methods.pm +++ b/examples/Methods.pm @@ -1,10 +1,10 @@ -package Method2; +package Methods; use lib 'lib/'; use Keyword; use Data::Dumper; keyword method (ident?, proto?, block) { - $block->begin("warn 'hello from me';"); + $block->begin("warn 'hello from Methods';"); $block->name($ident); }; diff --git a/lib/Keyword.pm b/lib/Keyword.pm index 86eb77c..3b44b32 100644 --- a/lib/Keyword.pm +++ b/lib/Keyword.pm @@ -116,7 +116,7 @@ sub proto_to_parselist { } case 'block' { - push @pa, + push @pa, {name=>$ident, parse=>\&{'Keyword::Parse::Block::new'}, action=>sub{return @_}, #returns block object opt=>$opt, builtin=>1} diff --git a/t/00-use.t b/t/00-use.t index 7a8954e..d2f1c35 100644 --- a/t/00-use.t +++ b/t/00-use.t @@ -1,4 +1,4 @@ use Test::More qw/no_plan/; use_ok('Keyword'); use lib 'examples/'; -use_ok('DevelDeclareExample'); +use_ok('DDExample'); diff --git a/t/01-dd-example.t b/t/01-dd-example.t index 028497f..5398560 100644 --- a/t/01-dd-example.t +++ b/t/01-dd-example.t @@ -2,7 +2,7 @@ package Foobar; use strict; use warnings; use lib 'examples/'; -use DevelDeclareExample; +use DDExample; sub new { my ($class,) = @_; diff --git a/t/02-syntax.t b/t/02-syntax.t index aa8e963..596215c 100644 --- a/t/02-syntax.t +++ b/t/02-syntax.t @@ -3,8 +3,11 @@ use Keyword; use Data::Dumper; ok 1; -keyword method (ident?, proto?, somethingelse) { - warn Dumper @_; +keyword method (ident?, proto?, thing, block) { + warn Dumper $ident; + warn Dumper $proto; + warn Dumper $thing; + warn Dumper $block; }; diff --git a/t/03-methods.t b/t/03-methods.t index 2d22e46..9ff07ad 100644 --- a/t/03-methods.t +++ b/t/03-methods.t @@ -1,7 +1,7 @@ package Foobar; use strict; use warnings; -use lib 'examples'; +use lib 'examples/'; use Methods; method something ($a, $b, $c) {