Re: calling methods on deserialized objects



thanks for your reply ...

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
What "internal connection" are you refering to? As far as i know, an object
is nothing more than a blessed hash reference!? So the "connection" between
hashref (object) and package (class) is the blessing (the packagename stored
with the hashref), or am I missing something here? If there IS actually
something more, this would explain the behaviour ...

2) after deserialization, objects referred to by references may be in
different locations.
This is not a problem (at least in my case). The serialized structure looks
good (I had a look at the session text file), references are replaced by
their serialized target, no memory address pointers inside ...

I have three bits of advice: 1) bless the hashes back into their
respective classes after deserialization,
they do have the correct class! (since ref($hashref) returns the correct
name).

2) use custom serialization and deserialization methods to reconstruct the
object tree for each request, and
would be an option ...
but I still hope to find a way to use the default session deserializer.

3) make sure the objects' package (class) files are loaded before
deserializing.
This is something I thought of too ...
I will check, if this helps. But anyway: if the packages would not have been
loaded, the "eval-way" of calling the method could not have worked, could
it?

This post is a WAG so forgive me if I'm totally off the wall.
I don't know what WAG stands for, but i forgive you in any case and thank
you for your time :-)


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.
If there is some "internal bytecode" could you please give me a link to an
explanation? Cause I didn't find anything like this in my perl book.

kind regards
Michael


.



Relevant Pages

  • Re: calling methods on deserialized objects
    ... serialization and deserialization breaks the internal connection between hashes and their associated classes, ... What "internal connection" are you refering to? ... The serialized structure looks good (I had a look at the session text file), references are replaced by their serialized target, no memory address pointers inside ... ... respective classes after deserialization, ...
    (comp.lang.perl.modules)
  • Re: calling methods on deserialized objects
    ... 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 files are loaded before deserializing. ... The reffunction 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. ...
    (comp.lang.perl.modules)
  • serialization inherited objects
    ... deserialization. ... Some extra propertys in the objects ... Now I would like some solution will the serialization keeps working. ... that in my app I would like to keep using my original name ...
    (microsoft.public.dotnet.languages.vb)
  • Re: cannot use static fields in AJAX applications?
    ... type's assembly is sufficient to resolve additional types. ... serializer construction for specific types. ... ViewState's built-in serialization does not like dynamically constructed ... serializers for later deserialization requests. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Serialization woes
    ... > serialization of an object (i.e. by implementing the ... > object and the call to the special constructor. ... its elements *until* deserialization is complete - ... aknak at aksoto dot idps dot co dot uk ...
    (microsoft.public.dotnet.languages.vb)