summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-03-31 13:45:57 +0000
committerNicholas Clark <nick@ccl4.org>2006-03-31 13:45:57 +0000
commitb3ca2e834c3607fd8aa8736a51aa3a2b8bba1044 (patch)
treef1269aa993bfdc23b5f797da9cb5920a56cec989 /mg.c
parent1eed7ad13024ea01ff5ebed041ba65b758770a0f (diff)
downloadperl-b3ca2e834c3607fd8aa8736a51aa3a2b8bba1044.tar.gz
Serialise changes to %^H onto the current COP. Return the compile time
state of %^H as an eleventh value from caller. This allows users to write pragmas. p4raw-id: //depot/perl@27643
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 210d681dd7..b7e2e56c08 100644
--- a/mg.c
+++ b/mg.c
@@ -2838,6 +2838,46 @@ S_unwind_handler_stack(pTHX_ const void *p)
}
/*
+=for apidoc magic_sethint
+
+Triggered by a store to %^H, records the key/value pair to
+C<PL_compiling.cop_hints>. It is assumed that hints aren't storing anything
+that would need a deep copy. Maybe we should warn if we find a reference.
+
+=cut
+*/
+int
+Perl_magic_sethint(pTHX_ SV *sv, MAGIC *mg)
+{
+ dVAR;
+ assert(mg->mg_len == HEf_SVKEY);
+
+ PL_compiling.cop_hints
+ = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints,
+ (SV *)mg->mg_ptr, newSVsv(sv));
+ return 0;
+}
+
+/*
+=for apidoc magic_sethint
+
+Triggered by a delete from %^H, records the key to C<PL_compiling.cop_hints>.
+
+=cut
+*/
+int
+Perl_magic_clearhint(pTHX_ SV *sv, MAGIC *mg)
+{
+ dVAR;
+ assert(mg->mg_len == HEf_SVKEY);
+
+ PL_compiling.cop_hints
+ = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints,
+ (SV *)mg->mg_ptr, &PL_sv_placeholder);
+ return 0;
+}
+
+/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4