# define VMG_UVAR 0
#endif
-/* Applied to dev-5.9 as 25854, integrated to maint-5.8 as 28160 */
-#ifndef VMG_COMPAT_ARRAY_PUSH_NOLEN
-# if VMG_HAS_PERL_MAINT(5, 8, 9, 28160) || VMG_HAS_PERL_MAINT(5, 9, 3, 25854) || VMG_HAS_PERL(5, 10, 0)
+/* Applied to dev-5.9 as 25854, integrated to maint-5.8 as 28160, partially
+ * reverted to dev-5.11 as 9cdcb38b */
+#if VMG_HAS_PERL_MAINT(5, 8, 9, 28160) || VMG_HAS_PERL_MAINT(5, 9, 3, 25854) || VMG_HAS_PERL(5, 10, 0)
+# ifndef VMG_COMPAT_ARRAY_PUSH_NOLEN
# define VMG_COMPAT_ARRAY_PUSH_NOLEN 1
-# else
+# endif
+# ifndef VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID
+# define VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID 1
+# endif
+#else
+# ifndef VMG_COMPAT_ARRAY_PUSH_NOLEN
# define VMG_COMPAT_ARRAY_PUSH_NOLEN 0
# endif
+# ifndef VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID
+# define VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID 0
+# endif
#endif
/* Applied to dev-5.11 as 34908 */
newCONSTSUB(stash, "VMG_UVAR", newSVuv(VMG_UVAR));
newCONSTSUB(stash, "VMG_COMPAT_ARRAY_PUSH_NOLEN",
newSVuv(VMG_COMPAT_ARRAY_PUSH_NOLEN));
+ newCONSTSUB(stash, "VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID",
+ newSVuv(VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID));
newCONSTSUB(stash, "VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID",
newSVuv(VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID));
newCONSTSUB(stash, "VMG_COMPAT_ARRAY_UNDEF_CLEAR",
push @DEFINES, '-DVMG_PERL_PATCHLEVEL=' . $pl;
print $pl, "\n";
} else {
+ $pl = undef;
print "none\n";
}
}
print $is_as ? "yes\n" : "no\n";
+my $is_5110rel = 0;
+print "Checking if this is a released perl 5.11.0... ";
+if ($^V eq v5.11.0 and not defined $pl) {
+ my $describe = $Config{git_describe};
+ if (defined $describe and $describe !~ /^GitLive-/) {
+ $is_5110rel = 1;
+ push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=0';
+ }
+}
+print $is_5110rel ? "yes\n" : "no\n";
+
# Threads, Windows and 5.8.x don't seem to be best friends
if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
push @DEFINES, '-DVMG_MULTIPLICITY=0';
=head2 C<VMG_COMPAT_ARRAY_PUSH_NOLEN>
True for perls that don't call 'len' magic when you push an element in a magical array.
+Starting from perl 5.11.0, this only refers to pushes in non-void context and hence is false.
+
+=head2 C<VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID>
+
+True for perls that don't call 'len' magic when you push in void context an element in a magical array.
=head2 C<VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID>
I<p34908> : 'len' magic is no longer called when pushing / unshifting an element into a magical array in void context.
The C<push> part was already covered by I<p25854>.
+I<g9cdcb38b> : 'len' magic is called again when pushing into a magical array in non-void context.
+
=back
=head1 EXPORT
'funcs' => [ qw/wizard gensig getsig cast getdata dispell/ ],
'consts' => [
qw/SIG_MIN SIG_MAX SIG_NBR MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR/,
- qw/VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_SCALAR_LENGTH_NOLEN/,
+ qw/VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID/,
+ qw/VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID/,
+ qw/VMG_COMPAT_ARRAY_UNDEF_CLEAR/,
+ qw/VMG_COMPAT_SCALAR_LENGTH_NOLEN/,
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 * 22;
+use Test::More tests => 2 * 23;
require Variable::Magic;
map { $_ => '' } qw/
SIG_MIN SIG_MAX SIG_NBR
MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR
- VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID
- VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_SCALAR_LENGTH_NOLEN
+ VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID
+ VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID
+ VMG_COMPAT_ARRAY_UNDEF_CLEAR
+ VMG_COMPAT_SCALAR_LENGTH_NOLEN
VMG_PERL_PATCHLEVEL
VMG_THREADSAFE VMG_FORKSAFE
VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT
use Test::More tests => 2 * 27 + 13 + 1;
-use Variable::Magic qw/cast dispell VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR/;
+use Variable::Magic qw/cast dispell VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR/;
use lib 't/lib';
use Variable::Magic::TestWatcher;
is $b, 2, 'array: length $# correctly';
watch { push @a, 'x'; () }
- { set => 1, (len => 1) x !VMG_COMPAT_ARRAY_PUSH_NOLEN },'push (void)';
+ { set => 1, (len => 1) x !VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID },
+ 'push (void)';
$b = watch { push @a, 'y' }
- { set => 1, (len => 1) x !VMG_COMPAT_ARRAY_PUSH_NOLEN }, 'push (scalar)';
+ { set => 1, (len => 1) x !VMG_COMPAT_ARRAY_PUSH_NOLEN },
+ 'push (scalar)';
is $b, 5, 'array: push (scalar) correctly';
$b = watch { pop @a } { set => 1, len => 1 }, 'pop';