in reply to Re^5: Cloning shared hashref
in thread Cloning shared hashref

Sure. I was running some functions in separate threads, returning graph-like structures (feature annotations of genome data), e.g.

my $gene = { lots => 'of', data => 'entries' }; my $transcript = { 'even' => 'more', data => 'entries', gene => $gene +}; $gene->{transcript} = [ $transcript ];

I put everything in a result queue of type Thread::Queue. I dequeue and freeze the results to a YAML file after the program finishes, so that I don't have to calculate everything again and again. Unfortunately, Thread::Queue does a shared_clone on everything one throws at it.

This fact leads to the mentioned 'program requirements':

  1. Handle circular references
  2. Save some space with reusing references
I hope this answers your question.