note 4116 deleted from ref.wddx by felipe
| From: | felipe@php.net | Date: | Sun, 20 Jul 2008 23:34:13 +0000 |
| Subject: | note 4116 deleted from ref.wddx by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142355@lists.php.net to get a copy of this message | ||
Note Submitter: djm at web dot us dot uu dot net
----
Here's a rewrite of the deserializing Perl code that uses variable names consistently with the
serializing example. Sorry for any confusion....
<PRE>
#!/usr/bin/perl
use WDDX;
open(FP, "<cities.wddx");
undef $/; # Slurp the whole file.
$packet = <FP>;
close(FP);
$wddx = new WDDX;
$packet_id = $wddx->deserialize($packet);
$value = $packet_id->as_hashref();
print "pi is:<br>" . $value->{"pi"} . "<p>\n";
print "cities is:<br>\n";
$key = 0;
foreach $val (@{$value->{"cities"}}) {
print "$key => $val<br>\n";
$key++;
}
</PRE>