Just as to answer the point:

Yes, Storable::freeze does create a lot of funny characters.

To escape that problem, and to use a Storable::freeze'd value in a hash 
and then to xml-ise it with XML::Simple, you can use the MIME::Base64
package to encode it in Base64 and then it's no problem for the parser
to parse the xml string and THEN get the coded string and decode it.

Hope it can help someone, some day...



Le lun 17/03/2003 à 10:59, Yannick Warnier a écrit :
> Nevermind for the errors quoted, this isn't related to serialisation.
> However, the problem is still there.
> 
> 
> Le lun 17/03/2003 à 10:23, Yannick Warnier a écrit :
> > Hi,
> > 
> > I came to a little problem trying to "thaw" a hash with storable. In
> > fact I'm somehow forced to use a hash that contains this serialised
> > (freezed) hash, and then pass it to XML::Simple as to make an xml
> > document with this.
> > 
> > So, what I do is something like
> > 
> > $parsedMsg->{'container'}->{'serialised'} = freeze(dclone($hash));
> > # after having set my parsing parameters in XMLin object:
> > $xmlString = XML::Simple::XMLin($parsedMsg);
> > 
> > Then, from the other side, I just do this:
> > $parsedMsg = XML::Simple::XMLout($xmlString);
> > $hash = thaw($parsedMsg->{'container'}->{'serialised'});
> > 
> > 
> > But that just creates a lot of errors.
> > In fact, the xml string is passed via a socket and everything, and I am
> > absolutely sure that everything else than the freeze, thaw and dclone
> > work very nicely cause I also tried it with just a string in the
> > "serialised" element (the string not being serialised this time) and it
> > works.
> > 
> > So, the problem, I think, is that the XML::Simple parser doesn't get
> > right xml cause there's a lot of funny characters introduced by the
> > serialisation. The errors I got are:
> > 
> > Use of uninitialized value in substitution (s///) at
> > /usr/share/perl5/XML/Simple.pm line 1016.
> > Use of uninitialized value in substitution (s///) at
> > /usr/share/perl5/XML/Simple.pm line 1017.
> > Use of uninitialized value in substitution (s///) at
> > /usr/share/perl5/XML/Simple.pm line 1018.
> > Use of uninitialized value in substitution (s///) at
> > /usr/share/perl5/XML/Simple.pm line 1019.
> > Use of uninitialized value in join or string at
> > /usr/share/perl5/XML/Simple.pm
> > line 1000.
> > 
> > But this doesn't really matter.
> > 
> > So here come my questions:
> > - Am I right guessing the "freeze" function gives a lot of funny
> > characters?
> > - What is the best solution? (make a formatting function to avoid funny
> > characters once serialised, use something else than freeze, or what?)
> > 
> > 
> > If you have any idea, that may help greatly,
> > Thanks,
> > 
> > Yannick


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to