use Test::More;
-use Variable::Magic qw/wizard cast dispell VMG_UVAR VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/;
+use Variable::Magic qw<
+ wizard cast dispell
+ VMG_UVAR VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT
+>;
my $run;
if (VMG_UVAR) {
()
}
CB
-} qw/fetch store exists delete/);
+} qw<fetch store exists delete>);
$code .= ', data => sub { +{ guard => 0 } }';
is $@, "ok\n", 'stash: variables compiled fine';
is_deeply \%mg, {
- fetch => [ qw/thing stuff/ ],
- store => [ qw/thing stuff/ ],
+ fetch => [ qw<thing stuff> ],
+ store => [ qw<thing stuff> ],
}, 'stash: variables';
}
is $@, "ok\n", 'stash: function definitions compiled fine';
is_deeply \%mg, {
- store => [ qw/eat shoot leave shoot/ ],
+ store => [ qw<eat shoot leave shoot> ],
}, 'stash: function definitions';
}
roam();
};
- my @calls = qw/eat shoot leave roam yawn roam/;
+ my @calls = qw<eat shoot leave roam yawn roam>;
is $@, "ok\n", 'stash: function calls compiled fine';
is_deeply \%mg, {
fetch => \@calls,
- store => ($] < 5.011002 ? \@calls : [ map { ($_) x 2 } @calls ]),
+ store => ("$]" < 5.011_002 ? \@calls : [ map { ($_) x 2 } @calls ]),
}, 'stash: function calls';
}
is $@, '', 'stash: valid method call ran fine';
is_deeply \%mg, {
- fetch => [ qw/shoot/ ],
+ fetch => [ qw<shoot> ],
}, 'stash: valid method call';
}
is $@, '', 'stash: second valid method call ran fine';
is_deeply \%mg, {
- fetch => [ qw/shoot/ ],
+ fetch => [ qw<shoot> ],
}, 'stash: second valid method call';
}
is $@, '', 'stash: valid dynamic method call ran fine';
is_deeply \%mg, {
- store => [ qw/shoot/ ],
+ store => [ qw<shoot> ],
}, 'stash: valid dynamic method call';
}
is $@, '', 'inherited valid method call ran fine';
is_deeply \%mg, {
- fetch => [ qw/ISA leave/ ],
+ fetch => [ qw<ISA leave> ],
}, 'stash: inherited valid method call';
}
is $@, '', 'inherited previously called valid method call ran fine';
is_deeply \%mg, {
- fetch => [ qw/shoot/ ],
+ fetch => [ qw<shoot> ],
}, 'stash: inherited previously called valid method call';
}
like $@, qr/^Can't locate object method "unknown" via package "Hlagh"/, 'stash: invalid method call croaked';
is_deeply \%mg, {
- fetch => [ qw/unknown/ ],
- store => [ qw/unknown AUTOLOAD/ ],
+ fetch => [ qw<unknown> ],
+ store => [ qw<unknown AUTOLOAD> ],
}, 'stash: invalid method call';
}
like $@, qr/^Can't locate object method "unknown_too" via package "Hlagh"/, 'stash: invalid dynamic method call croaked';
is_deeply \%mg, {
- store => [ qw/unknown_too AUTOLOAD/ ],
+ store => [ qw<unknown_too AUTOLOAD> ],
}, 'stash: invalid dynamic method call';
}
like $@, qr/^Can't locate object method "also_unknown" via package "Hlagher"/, 'stash: invalid inherited method call croaked';
is_deeply \%mg, {
- fetch => [ qw/also_unknown AUTOLOAD/ ],
+ fetch => [ qw<also_unknown AUTOLOAD> ],
}, 'stash: invalid method call';
}
{
local %mg;
+ my @expected_stores = map { ($_) x 2 } qw<nevermentioned eat shoot>;
+ push @expected_stores, 'nevermentioned' if "$]" < 5.017_001;
+
eval q{
package Hlagh;
undef &nevermentioned;
};
is $@, '', 'stash: delete executed fine';
- is_deeply \%mg, {
- store => [
- qw/nevermentioned nevermentioned eat eat shoot shoot nevermentioned/
- ],
- }, 'stash: delete';
+ is_deeply \%mg, { store => \@expected_stores }, 'stash: delete';
}
END {
{
package AutoHlagh;
- use vars qw/$AUTOLOAD/;
+ use vars qw<$AUTOLOAD>;
sub AUTOLOAD { return $AUTOLOAD }
}
is $res, 'AutoHlagh::autoloaded',
'stash: autoloaded method call returned the right thing';
is_deeply \%mg, {
- fetch => [ qw/autoloaded/ ],
- store => [ qw/autoloaded AUTOLOAD AUTOLOAD/ ],
+ fetch => [ qw<autoloaded> ],
+ store => [ qw<autoloaded AUTOLOAD AUTOLOAD> ],
}, 'stash: autoloaded method call';
}
is $res, 'AutoHlagher::also_autoloaded',
'stash: inherited autoloaded method returned the right thing';
is_deeply \%mg, {
- fetch => [ qw/also_autoloaded AUTOLOAD/ ],
- store => [ qw/AUTOLOAD/ ],
+ fetch => [ qw<also_autoloaded AUTOLOAD> ],
+ store => [ qw<AUTOLOAD> ],
}, 'stash: inherited autoloaded method call';
}
()
}
CB
-} qw/fetch store exists delete/);
+} qw<fetch store exists delete>);
-my $uo_exp = $] < 5.011002 ? 2 : 3;
+my $uo_exp = "$]" < 5.011_002 ? 2 : 3;
$code .= ', data => sub { +{ guard => 0 } }';