On Thu, 26 Apr 2001, Andrew Pimlott wrote: [ ... deletia ... ] > There's also the matter of needing to turn off strict. [ ... deletia ... ] > Finally, there are no examples of how to use Data::Dumper for reliable > serialization (or at least, as reliable as feasible, with caveats about > things like sub refs). This is what I do: > > use Data::Dumper; > > $dumper = new Data::Dumper [ $data ]; > $dumped = $dumper->Purity(1)->Dump; > ... > { > no strict 'vars'; > local $VAR1; > eval $dumped; > die "toast: $@" if $@; > $data = $VAR1; > } I won't address your comments about the difficulty of using self-referential data, but the strictness can be addressed using the two-argument form of new(). Serializing: my $dumper = Data::Dumper->new([ $data ], [ "data" ]); my $dumped = $dumper->Purity(1)->Dump; Retrieving: my $data; eval $dumped; die "toast: $@" if $@; And have you considered Storable? Cheers, -Ben -- signer: can't create ~/.sig: Name not unique on networkThread Previous | Thread Next