-A -g --skip-ppport -nHash::Util::FieldHash
Fri Jun 23 22:31:59 CEST 2006
- accepted as v5.9.4 DEVEL28420
+
+
+0.02 Fri Apr 20 22:22:57 CEST 2007
+ - Bugfix: string keys are now checked whether they represent
+ an object, so %fieldhash_clone = %fieldhash_orig works.
SV* keysv;
if (mg) {
keysv = mg->mg_obj;
+ if (keysv && !SvROK(keysv)) { /* is string an object-id? */
+ SV* obj = HUF_ask_trigger(keysv);
+ if (obj)
+ keysv = obj; /* use the object instead, so registry happens */
+ }
if (keysv && SvROK(keysv)) {
SV* ob_id = HUF_obj_id(keysv);
mg->mg_obj = ob_id; /* key replacement */
is( keys %$ob_reg, @obs, "all obs unregistered");
}
+
+# direct hash assignment
+BEGIN { $n_tests += 4 }
+{
+ fieldhashes \ my( %f, %g, %h);
+ my $size = 6;
+ my @obs = map [], 1 .. $size;
+ @f{ @obs} = ( 1) x $size;
+ $g{ $_} = $f{ $_} for keys %f; # single assignment
+ %h = %f; # wholesale assignment
+ @obs = ();
+ is keys %$ob_reg, 0, "all keys collected";
+ is keys %f, 0, "orig garbage-collected";
+ is keys %g, 0, "single-copy garbage-dollected";
+ is keys %h, 0, "wholesale-copy garbage-dollected";
+}
+
{
BEGIN { $n_tests += 1 }