This also makes the tests much more similar to MXD, which they emulate. Thanks
Zefram for this patch.
use Test::More tests => 1;
BEGIN {
require Devel::Declare;
+ *class = sub (&) { $_[0]->() };
Devel::Declare->setup_for(__PACKAGE__, {
class => {
const => sub {
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;
},
},
});
sub import {
require Devel::Declare;
my $caller = caller();
+ no strict 'refs';
+ *{ "${caller}::class" } = sub (&) { $_[0]->() };
Devel::Declare->setup_for($caller, {
class => {
const => sub {
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;
},
},
});