Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
It's dawned on me that I get YAML and JSON serialization for free now. My default may not work for your default (in fact, it probably won't), but here's what I have:
print $friend->to_xml;
print $friend->to_yaml;
print $friend->to_json;
That outputs:
<?xml version="1.0" encoding="utf-8"?>
<dummy version="3" name="Victoria" some_val="4">
<personal_email>victoria@example.com</personal_email>
<work_email>victoria@some_company.com</work_email>
</dummy>
---
attributes:
name: Victoria
some_val: 4
version: 3
elements:
-
attributes: {}
name: personal_email
value: victoria@example.com
-
attributes: {}
name: work_email
value: victoria@some_company.com
{
"elements" : [
{
"value" : "victoria@example.com",
"name" : "personal_email",
"attributes" : {
}
},
{
"value" : "victoria@some_company.com",
"name" : "work_email",
"attributes" : {
}
}
],
"name" : "dummy",
"attributes" : {
"version" : 3,
"name" : "Victoria",
"some_val" : 4
}
}
I'll probably have to adjust the code to optionally strip out empty elements and attributes since those look strange in the YAML and JSON.
Update: no, just serializing things directly into JSON and YAML is lousy. This clearly needs work.
Bermuda - YAML and JSON Serialization 0 Comments More | Login | Reply /