samples/vm_vs_tie.pl
t/00-load.t
t/01-import.t
+t/02-constants.t
t/10-simple.t
t/11-multiple.t
t/13-data.t
# define PERL_MAGIC_tied 'P'
#endif
-#ifndef MGf_COPY
-# define MGf_COPY 0
-#endif
-
-#ifndef MGf_DUP
-# define MGf_DUP 0
-#endif
-
#ifndef MGf_LOCAL
# define MGf_LOCAL 0
#endif
SV *cb_data;
SV *cb_get, *cb_set, *cb_len, *cb_clear, *cb_free;
-#if MGf_COPY
SV *cb_copy;
-#endif /* MGf_COPY */
-#if MGf_DUP
SV *cb_dup;
-#endif /* MGf_DUP */
#if MGf_LOCAL
SV *cb_local;
#endif /* MGf_LOCAL */
SvREFCNT_dec(w->cb_len);
SvREFCNT_dec(w->cb_clear);
SvREFCNT_dec(w->cb_free);
-#if MGf_COPY
SvREFCNT_dec(w->cb_copy);
-#endif /* MGf_COPY */
-#if 0 /* MGf_DUP */
+#if 0
SvREFCNT_dec(w->cb_dup);
-#endif /* MGf_DUP */
+#endif
#if MGf_LOCAL
SvREFCNT_dec(w->cb_local);
#endif /* MGf_LOCAL */
VMG_CLONE_CB(len);
VMG_CLONE_CB(clear);
VMG_CLONE_CB(free);
-#if MGf_COPY
VMG_CLONE_CB(copy);
-#endif /* MGf_COPY */
-#if MGf_DUP
VMG_CLONE_CB(dup);
-#endif /* MGf_DUP */
#if MGf_LOCAL
VMG_CLONE_CB(local);
#endif /* MGf_LOCAL */
NULL, /* len */
NULL, /* clear */
vmg_wizard_free, /* free */
-#if MGf_COPY
NULL, /* copy */
-#endif /* MGf_COPY */
-#if MGf_DUP
NULL, /* dup */
-#endif /* MGf_DUP */
#if MGf_LOCAL
NULL, /* local */
#endif /* MGf_LOCAL */
(const char *) wiz, HEf_SVKEY);
SvREFCNT_dec(data);
mg->mg_private = SIG_WIZ;
-#if MGf_COPY
if (w->cb_copy)
mg->mg_flags |= MGf_COPY;
-#endif /* MGf_COPY */
-#if 0 /* MGf_DUP */
+#if 0
if (w->cb_dup)
mg->mg_flags |= MGf_DUP;
-#endif /* MGf_DUP */
+#endif
#if MGf_LOCAL
if (w->cb_local)
mg->mg_flags |= MGf_LOCAL;
return ret;
}
-#if MGf_COPY
STATIC int vmg_svt_copy(pTHX_ SV *sv, MAGIC *mg, SV *nsv, const char *key,
# if VMG_HAS_PERL_MAINT(5, 11, 0, 33256) || VMG_HAS_PERL(5, 12, 0)
I32 keylen
return ret;
}
-#endif /* MGf_COPY */
-#if 0 /* MGf_DUP */
+#if 0
STATIC int vmg_svt_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) {
return 0;
}
-#endif /* MGf_DUP */
+#endif
#if MGf_LOCAL
STATIC int vmg_svt_local(pTHX_ SV *nsv, MAGIC *mg) {
CODE:
dMY_CXT;
- if (items != 7
-#if MGf_COPY
- + 1
-#endif /* MGf_COPY */
-#if MGf_DUP
- + 1
-#endif /* MGf_DUP */
+ if (items != 9
#if MGf_LOCAL
+ 1
#endif /* MGf_LOCAL */
VMG_SET_SVT_CB(ST(i++), len);
VMG_SET_SVT_CB(ST(i++), clear);
VMG_SET_SVT_CB(ST(i++), free);
-#if MGf_COPY
VMG_SET_SVT_CB(ST(i++), copy);
-#endif /* MGf_COPY */
-#if MGf_DUP
/* VMG_SET_SVT_CB(ST(i++), dup); */
i++;
t->svt_dup = NULL;
w->cb_dup = NULL;
-#endif /* MGf_DUP */
#if MGf_LOCAL
VMG_SET_SVT_CB(ST(i++), local);
#endif /* MGf_LOCAL */
my %opts = @_;
- my @keys = qw<op_info data get set len clear free>;
- push @keys, 'copy' if MGf_COPY;
- push @keys, 'dup' if MGf_DUP;
+ my @keys = qw<op_info data get set len clear free copy dup>;
push @keys, 'local' if MGf_LOCAL;
push @keys, qw<fetch store exists delete copy_key> if VMG_UVAR;
--- /dev/null
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use Variable::Magic qw<MGf_COPY MGf_DUP>;
+
+ok MGf_COPY, 'MGf_COPY is always true';
+ok MGf_DUP, 'MGf_DUP is always true';
use Test::More tests => 43;
-use Variable::Magic qw<wizard cast dispell MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR>;
+use Variable::Magic qw<wizard cast dispell MGf_LOCAL VMG_UVAR>;
my $inv_wiz_obj = qr/Invalid\s+wizard\s+object\s+at\s+\Q$0\E/;
-my $args = 7;
-++$args if MGf_COPY;
-++$args if MGf_DUP;
+my $args = 9;
++$args if MGf_LOCAL;
$args += 5 if VMG_UVAR;
for (0 .. 20) {
use Test::More;
-use Variable::Magic qw<cast dispell MGf_COPY>;
+use Variable::Magic qw<cast dispell>;
-if (MGf_COPY) {
- plan tests => 2 + ((2 * 5 + 3) + (2 * 2 + 1)) + (2 * 9 + 6) + 1;
-} else {
- plan skip_all => 'No copy magic for this perl';
-}
+plan tests => 2 + ((2 * 5 + 3) + (2 * 2 + 1)) + (2 * 9 + 6) + 1;
use lib 't/lib';
use Variable::Magic::TestWatcher;
use Test::More tests => (2 * 14 + 2) + 2 * (2 * 8 + 4) + 3 + 1;
-use Variable::Magic qw<wizard cast dispell MGf_COPY>;
+use Variable::Magic qw<wizard cast dispell>;
use lib 't/lib';
use Variable::Magic::TestWatcher;
watch { $h{b} = 4 } { }, 'hash element: set after delete';
SKIP: {
- my $SKIP;
-
- if (!MGf_COPY) {
- $SKIP = 'No copy magic for this perl';
- } else {
- local $@;
- unless (eval { require Tie::Array; 1 }) {
- $SKIP = 'Tie::Array required to test clear magic on tied array values';
- }
+ unless (do { local $@; eval { require Tie::Array; 1 } }) {
+ skip 'Tie::Array required to test clear magic on tied array values' => 3;
}
-
- skip $SKIP => 3 if $SKIP;
defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION;
tie my @a, 'Tie::StdArray';
use Test::More tests => (2 * 21 + 7) + (2 * 5 + 5) + 1;
-use Variable::Magic qw<cast dispell MGf_COPY VMG_UVAR>;
+use Variable::Magic qw<cast dispell VMG_UVAR>;
use lib 't/lib';
use Variable::Magic::TestWatcher;