]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/35-stash.t
There's no need to disable strict refs for getting the stash of a package whose name...
[perl/modules/Variable-Magic.git] / t / 35-stash.t
index 54c6b16b7048e5f55b0a93cfc4063977a5bd864e..a1b6a7de46ba847a9469c79aee09916df565e225 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Test::More;
 
-use Variable::Magic qw/wizard cast dispell VMG_UVAR/;
+use Variable::Magic qw/wizard cast dispell VMG_UVAR VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/;
 
 my $run;
 if (VMG_UVAR) {
@@ -34,10 +34,7 @@ $code .= ', data => sub { +{ guard => 0 } }';
 my $wiz = eval $code;
 diag $@ if $@;
 
-{
- no strict 'refs';
- cast %{"Hlagh::"}, $wiz;
-}
+cast %Hlagh::, $wiz;
 
 {
  local %mg;
@@ -48,7 +45,7 @@ diag $@ if $@;
   our $a;
   {
    package NotHlagh;
-   my $x = @Hlagh::b;
+   our $x = @Hlagh::b;
   }
  };
 
@@ -95,10 +92,7 @@ END {
  is_deeply \%mg, { }, 'stash: magic that remains at END time' if $run;
 }
 
-{
- no strict 'refs';
- dispell %{"Hlagh::"}, $wiz;
-}
+dispell %Hlagh::, $wiz;
 
 $code = 'wizard '
         . join (', ', map { <<CB;
@@ -114,13 +108,10 @@ CB
 
 $code .= ', data => sub { +{ guard => 0 } }';
 
-$wiz = eval $code . ', op_info => 1';
+$wiz = eval $code . ', op_info => ' . VMG_OP_INFO_NAME;
 diag $@ if $@;
 
-{
- no strict 'refs';
- cast %{"Hlagh::"}, $wiz;
-}
+cast %Hlagh::, $wiz;
 
 eval q{
  die "ok\n";
@@ -128,20 +119,14 @@ eval q{
  meh();
 };
 
-is $@, "ok\n", 'stash: function call with op_info 1 compiled fine';
+is $@, "ok\n", 'stash: function call with op name compiled fine';
 
-{
- no strict 'refs';
- dispell %{"Hlagh::"}, $wiz;
-}
+dispell %Hlagh::, $wiz;
 
-$wiz = eval $code . ', op_info => 2';
+$wiz = eval $code . ', op_info => ' . VMG_OP_INFO_OBJECT;
 diag $@ if $@;
 
-{
- no strict 'refs';
- cast %{"Hlagh::"}, $wiz;
-}
+cast %Hlagh::, $wiz;
 
 eval q{
  die "ok\n";
@@ -149,9 +134,6 @@ eval q{
  wat();
 };
 
-is $@, "ok\n", 'stash: function call with op_info 2 compiled fine';
+is $@, "ok\n", 'stash: function call with op object compiled fine';
 
-{
- no strict 'refs';
- dispell %{"Hlagh::"}, $wiz;
-}
+dispell %Hlagh::, $wiz;