Add the new compatibility macro VMG_COMPAT_GLOB_GET to reflect this change.
# define VMG_COMPAT_SCALAR_LENGTH_NOLEN 0
#endif
+#if VMG_HAS_PERL(5, 13, 2)
+# define VMG_COMPAT_GLOB_GET 1
+#else
+# define VMG_COMPAT_GLOB_GET 0
+#endif
+
/* ... Bug-free mg_magical ................................................. */
/* See the discussion at http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-01/msg00036.html. This version is specialized to our needs. */
newSVuv(VMG_COMPAT_ARRAY_UNDEF_CLEAR));
newCONSTSUB(stash, "VMG_COMPAT_SCALAR_LENGTH_NOLEN",
newSVuv(VMG_COMPAT_SCALAR_LENGTH_NOLEN));
+ newCONSTSUB(stash, "VMG_COMPAT_GLOB_GET", newSVuv(VMG_COMPAT_GLOB_GET));
newCONSTSUB(stash, "VMG_PERL_PATCHLEVEL", newSVuv(VMG_PERL_PATCHLEVEL));
newCONSTSUB(stash, "VMG_THREADSAFE", newSVuv(VMG_THREADSAFE));
newCONSTSUB(stash, "VMG_FORKSAFE", newSVuv(VMG_FORKSAFE));
True for perls that don't call 'len' magic when taking the C<length> of a magical scalar.
+=head2 C<VMG_COMPAT_GLOB_GET>
+
+True for perls that call 'get' magic for operations on globs.
+
=head2 C<VMG_PERL_PATCHLEVEL>
The perl patchlevel this module was built with, or C<0> for non-debugging perls.
qw/VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID/,
qw/VMG_COMPAT_ARRAY_UNDEF_CLEAR/,
qw/VMG_COMPAT_SCALAR_LENGTH_NOLEN/,
+ qw/VMG_COMPAT_GLOB_GET/,
qw/VMG_PERL_PATCHLEVEL/,
qw/VMG_THREADSAFE VMG_FORKSAFE/,
qw/VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/
use strict;
use warnings;
-use Test::More tests => 2 * 18;
+use Test::More tests => 2 * 19;
require Variable::Magic;
VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID
VMG_COMPAT_ARRAY_UNDEF_CLEAR
VMG_COMPAT_SCALAR_LENGTH_NOLEN
+ VMG_COMPAT_GLOB_GET
VMG_PERL_PATCHLEVEL
VMG_THREADSAFE VMG_FORKSAFE
VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT
diag "Using Symbol $Symbol::VERSION" if defined $Symbol::VERSION;
}
-use Variable::Magic qw/cast dispell/;
+use Variable::Magic qw/cast dispell VMG_COMPAT_GLOB_GET/;
+
+my %get = VMG_COMPAT_GLOB_GET ? (get => 1) : ();
use lib 't/lib';
use Variable::Magic::TestWatcher;
local *a = gensym();
-watch { cast *a, $wiz } { }, 'cast';
+watch { cast *a, $wiz } +{ }, 'cast';
-watch { local *b = *a } { }, 'assign to';
+watch { local *b = *a } +{ %get }, 'assign to';
-watch { *a = gensym() } { set => 1 }, 'assign';
+watch { *a = gensym() } +{ %get, set => 1 }, 'assign';
watch {
local *b = gensym();
- watch { cast *b, $wiz } { }, 'cast 2';
-} { }, 'scope end';
+ watch { cast *b, $wiz } +{ }, 'cast 2';
+} +{ }, 'scope end';
-watch { undef *a } { }, 'undef';
+watch { undef *a } +{ %get }, 'undef';
-watch { dispell *a, $wiz } { }, 'dispell';
+watch { dispell *a, $wiz } +{ %get }, 'dispell';