Re: calling methods on deserialized objects
- From: "Mumia W." <mumia.w.18.spam+nospam.usenet@xxxxxxxxxxxxx>
- Date: Fri, 25 Aug 2006 21:26:54 GMT
On 08/25/2006 03:32 PM, wrote:
Hello Perl Specialists,
i'm struggling with a weird problem ....
background:
I have stored an "object tree" in a CGI::Session. I want to make the whole object model persistent, when the page has finished rendering and restore all the stuff when the page is loaded by a new request. So far so good: The object structure seems to be serialized correct [ but method calls don't work ... ]
I've haven't used CGI::Session, but I don't think it'll work for two reasons: 1) serialization and deserialization breaks the internal connection between hashes and their associated classes, and 2) after deserialization, objects referred to by references may be in different locations.
I have three bits of advice: 1) bless the hashes back into their respective classes after deserialization, 2) use custom serialization and deserialization methods to reconstruct the object tree for each request, and 3) make sure the objects' package (class) files are loaded before deserializing.
This post is a WAG so forgive me if I'm totally off the wall.
PS.
The ref() function returns a string of text and, by itself, is no indication that the internal bytecode that connects a hash reference to a class is still there.
.
- Follow-Ups:
- Re: calling methods on deserialized objects
- From: Michael Küper
- Re: calling methods on deserialized objects
- References:
- calling methods on deserialized objects
- From: Michael Küper
- calling methods on deserialized objects
- Prev by Date: calling methods on deserialized objects
- Next by Date: Re: Perl module that simplifies creation of packages?
- Previous by thread: calling methods on deserialized objects
- Next by thread: Re: calling methods on deserialized objects
- Index(es):
Relevant Pages
|