diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-03-31 13:45:57 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-03-31 13:45:57 +0000 |
commit | b3ca2e834c3607fd8aa8736a51aa3a2b8bba1044 (patch) | |
tree | f1269aa993bfdc23b5f797da9cb5920a56cec989 /mg.c | |
parent | 1eed7ad13024ea01ff5ebed041ba65b758770a0f (diff) | |
download | perl-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.c | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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 |