+/* xsutils.c
+ *
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+ * by Larry Wall and others
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
+ *
+ */
+
+/*
+ * "Perilous to us all are the devices of an art deeper than we possess
+ * ourselves." --Gandalf
+ */
+
+
#include "EXTERN.h"
#define PERL_IN_XSUTILS_C
#include "perl.h"
switch ((int)len) {
case 6:
switch (*name) {
+ case 'a':
+ if (strEQ(name, "assertion")) {
+ if (negated)
+ CvFLAGS((CV*)sv) &= ~CVf_ASSERTION;
+ else
+ CvFLAGS((CV*)sv) |= CVf_ASSERTION;
+ continue;
+ }
+ break;
case 'l':
#ifdef CVf_LVALUE
if (strEQ(name, "lvalue")) {
continue;
}
break;
- case 's':
- if (strEQ(name, "unique")) {
- if (negated)
- GvUNIQUE_off(CvGV((CV*)sv));
- else
- GvUNIQUE_on(CvGV((CV*)sv));
- continue;
- }
- break;
}
break;
}
break;
default:
switch ((int)len) {
- case 6:
+ case 6:
switch (*name) {
- case 's':
- if (strEQ(name, "unique")) {
- /* toke.c has already marked as GVf_UNIQUE */
+ case 's':
+ if (strEQ(name, "shared")) {
+ if (negated)
+ Perl_croak(aTHX_ "A variable may not be unshared");
+ SvSHARE(sv);
+ continue;
+ }
+ break;
+ case 'u':
+ if (strEQ(name, "unique")) {
+ if (SvTYPE(sv) == SVt_PVGV) {
+ if (negated)
+ GvUNIQUE_off(sv);
+ else
+ GvUNIQUE_on(sv);
+ }
+ /* Hope this came from toke.c if not a GV. */
continue;
}
}
if (cvflags & CVf_METHOD)
XPUSHs(sv_2mortal(newSVpvn("method", 6)));
if (GvUNIQUE(CvGV((CV*)sv)))
- XPUSHs(sv_2mortal(newSVpvn("unique", 6)));
+ XPUSHs(sv_2mortal(newSVpvn("unique", 6)));
+ if (cvflags & CVf_ASSERTION)
+ XPUSHs(sv_2mortal(newSVpvn("assertion", 9)));
+ break;
+ case SVt_PVGV:
+ if (GvUNIQUE(sv))
+ XPUSHs(sv_2mortal(newSVpvn("unique", 6)));
break;
default:
break;