sv_setsv_cow_hashkey_notcore()
void
+sv_set_deref(SV *sv, SV *sv2, int which)
+ CODE:
+ {
+ STRLEN len;
+ const char *pv = SvPV(sv2,len);
+ if (!SvROK(sv)) croak("Not a ref");
+ sv = SvRV(sv);
+ switch (which) {
+ case 0: sv_setsv(sv,sv2); break;
+ case 1: sv_setpv(sv,pv); break;
+ case 2: sv_setpvn(sv,pv,len); break;
+ }
+ }
+
+void
rmagical_cast(sv, type)
SV *sv;
SV *type;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 6;
BEGIN { use_ok('XS::APItest') };
ok(!sv_setsv_cow_hashkey_notcore,
"Without PERL_CORE sv_setsv doesn't COW for shared hash key scalars");
+
+*AUTOLOAD = \&XS::APItest::AutoLoader::AUTOLOADp;
+foo(\1); sv_set_deref(\&AUTOLOAD, '$', 0);
+is prototype(\&AUTOLOAD), '$', 'sv_setsv(cv,...) sets prototype';
+foo(\1); sv_set_deref(\&AUTOLOAD, '$', 1);
+is prototype(\&AUTOLOAD), '$', 'sv_setpv(cv,...) sets prototype';
+foo(\1); sv_set_deref(\&AUTOLOAD, '$', 2);
+is prototype(\&AUTOLOAD), '$', 'sv_setpvn(cv,...) sets prototype';
SvCUR_set(dstr, len);
SvPOK_only(dstr);
SvFLAGS(dstr) |= sflags & SVf_UTF8;
+ CvAUTOLOAD_off(dstr);
} else {
SvOK_off(dstr);
}
SvCUR_set(sv, len);
(void)SvPOK_only_UTF8(sv); /* validate pointer */
SvTAINT(sv);
+ if (SvTYPE(sv) == SVt_PVCV) CvAUTOLOAD_off(sv);
}
/*
SvCUR_set(sv, len);
(void)SvPOK_only_UTF8(sv); /* validate pointer */
SvTAINT(sv);
+ if (SvTYPE(sv) == SVt_PVCV) CvAUTOLOAD_off(sv);
}
/*