From: Florian Ragwitz Date: Tue, 12 Apr 2011 07:22:24 +0000 (+0200) Subject: Fix test failures on old perls X-Git-Tag: 0.006003~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8392ec1a1821bf10d237af4caab750c24c25120d;p=p5sagit%2FDevel-Declare.git Fix test failures on old perls This also makes the tests much more similar to MXD, which they emulate. Thanks Zefram for this patch. --- diff --git a/t/early0.t b/t/early0.t index 2f5c94f..41d7e7c 100644 --- a/t/early0.t +++ b/t/early0.t @@ -3,6 +3,7 @@ use warnings; use Test::More tests => 1; BEGIN { require Devel::Declare; + *class = sub (&) { $_[0]->() }; Devel::Declare->setup_for(__PACKAGE__, { class => { const => sub { @@ -13,9 +14,6 @@ BEGIN { my $l = Devel::Declare::get_linestr(); substr $l, $off + 1, 0, 'pass q[injected];' . (';' x 1000); Devel::Declare::set_linestr($l); - my $class = sub (&) { $_[0]->() }; - no strict 'refs'; - *{ $kw } = $class; }, }, }); diff --git a/t/early1_x.pm b/t/early1_x.pm index 89dc1cb..12fb55f 100644 --- a/t/early1_x.pm +++ b/t/early1_x.pm @@ -4,6 +4,8 @@ use warnings; sub import { require Devel::Declare; my $caller = caller(); + no strict 'refs'; + *{ "${caller}::class" } = sub (&) { $_[0]->() }; Devel::Declare->setup_for($caller, { class => { const => sub { @@ -14,9 +16,6 @@ sub import { my $l = Devel::Declare::get_linestr(); substr $l, $off + 1, 0, 'pass q[injected];' . (';' x 1000); Devel::Declare::set_linestr($l); - my $class = sub (&) { $_[0]->() }; - no strict 'refs'; - *{ "${caller}::$kw" } = $class; }, }, });