I32 index, /* get/set will see this */
SV* thing /* any associated info */
) {
- MAGIC* mg;
struct ufuncs uf;
uf.uf_val = val;
uf.uf_set = set;
hv_store_ent(field_tab, field_id, field_ref, 0);
}
+#define HV_FETCH_ISSTORE 0x01
+#define HV_FETCH_ISEXISTS 0x02
+#define HV_FETCH_LVALUE 0x04
+#define HV_FETCH_JUST_SV 0x08
+
+#define HUF_WOULD_CREATE_KEY(x) ((x) != -1 && ((x) & (HV_FETCH_ISSTORE | HV_FETCH_LVALUE)))
+
/* The key exchange function. It communicates with S_hv_magic_uvar_xkey
* in hv.c */
I32 HUF_watch_key(pTHX_ IV action, SV* field) {
SV* keysv = mg->mg_obj;
if (keysv && SvROK(keysv)) {
SV* ob_id = HUF_obj_id(keysv);
- SV* trigger = HUF_get_trigger(keysv, ob_id);
- HUF_mark_field(trigger, field);
mg->mg_obj = ob_id; /* key replacement */
+ if (HUF_WOULD_CREATE_KEY(action)) {
+ SV* trigger = HUF_get_trigger(keysv, ob_id);
+ HUF_mark_field(trigger, field);
+ }
}
return 0;
}
NAME => 'Hash::Util::FieldHash',
VERSION_FROM => 'lib/Hash/Util/FieldHash.pm', # finds $VERSION
PREREQ_PM => {}, # e.g., Module::Name => 1.1
- (grep( /^PERL_CORE=1$/, @ARGV) ? (MAN3PODS => {}) : ()),
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Hash/Util/FieldHash.pm', # retrieve abstract from module
- AUTHOR => 'Anno Siegel <anno@zrz.tu-berlin.de>') : ()),
+ AUTHOR => 'Anno Siegel <anno4000@zrz.tu-berlin.de>') : ()),
LIBS => [''], # e.g., '-lm'
DEFINE => '', # e.g., '-DHAVE_SOMETHING'
- # Insert -I. if you add *.h files later:
+ # Insert -I. if you add *.h files later:
INC => '', # e.g., '-I/usr/include/other'
- # Un-comment this if you add C files to link with later:
+ # Un-comment this if you add C files to link with later:
# OBJECT => '$(O_FILES)', # link all the C files too
- # CCFLAGS => '-Wuninitialized',
+ # Don't manify in core build
+ (grep( /^PERL_CORE=1$/, @ARGV) ?
+ (MAN3PODS => {}) :
+ ()),
);