I'm trying to create a multi level hash of hashes/arrays
Here's my code:
HV*
PortInfo(cp,profile=NULL)
  Laff::Cell  cp
  char*       profile
CODE:
{
  node_p  names,np;
  HV      *top,*hv;
  name_p  name;

  top = newHV();
  RETVAL = top;
  names = node_find(cp->head,lNAMES);
  np = node_next(names,names);
  while(np)
  {
    if (np->type EQ lNAME)
    {
      name = (name_p) np->data;
      hv = newHV();
      hv_store(top,name->name,strlen(name->name),(SV*)hv,0);
    }
    np = node_next(np,names);
  }
}
OUTPUT:
  RETVAL


Here's the output I get from Data::Dumper
Bizarre copy of HASH in each at
/apps/perl5.005/lib/5.00502/Data/Dumper.pm line 309.

What am I doing wrong?

frome perlguts
Note that both hv_store and hv_store_ent do not increment
     the reference count of the stored val, which is the caller's
     responsibility.  If these functions return a NULL value, the
     caller will usually have to decrement the reference count of
     val to avoid a memory leak.

>From my code above do i need to increment the count for top or hv?


Reply via email to