-package DevelDeclareExample;
+package DDExample;
use strict;
use warnings;
use Devel::Declare;
);
no strict 'refs';
*{$caller.'::method'} = sub (&) {};
- use warnings;
}
our ($Declarator, $Offset);
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 });
}
sub scope_injector_call {
- return ' BEGIN { DevelDeclareExample::inject_scope() }; ';
+ return ' BEGIN { DDExample::inject_scope() }; ';
}
sub shadow {
-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);
};
}
case 'block' {
- push @pa,
+ push @pa,
{name=>$ident, parse=>\&{'Keyword::Parse::Block::new'},
action=>sub{return @_}, #returns block object
opt=>$opt, builtin=>1}
use Test::More qw/no_plan/;
use_ok('Keyword');
use lib 'examples/';
-use_ok('DevelDeclareExample');
+use_ok('DDExample');
use strict;
use warnings;
use lib 'examples/';
-use DevelDeclareExample;
+use DDExample;
sub new {
my ($class,) = @_;
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;
};
package Foobar;
use strict;
use warnings;
-use lib 'examples';
+use lib 'examples/';
use Methods;
method something ($a, $b, $c) {