Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
laziness, impatience, and hubris
 
PerlMonks  

Re: Storable alternatives

by vsespb (Hermit)
on May 17, 2013 at 13:06 UTC ( #1033969=note: print w/ replies, xml ) Need Help??


in reply to Storable alternatives

What's stopping you from using procedural programming?

sub my_serialize { my $obj = shift; if (check_some_condition($obj)) { return freeze replace($obj) } return freeze $obj; # serialize $obj as is }; my $data = my_serialize($tree)


Comment on Re: Storable alternatives
Download Code
Re^2: Storable alternatives
by salva (Monsignor) on May 17, 2013 at 13:41 UTC
    $tree may be an arbitrarily complex structure and I just want to replace some of the objects inside at serialization time.

    Your code can only be used to replace the top object.

      Your code can only be used to replace the top object.
      Not quite understand. replace() sub here _can_ replace just _some_ of the inner objects of $tree
        Oh, but then, I would have to traverse and clone the data structure myself, something that is far for easier in the general case.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033969]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-04-23 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (556 votes), past polls