I had some breakthrough ideas for YAML.pm today. I've figured out the API for
transfering various data types in YAML.pm. Now I'll be able to deal with Perl
objects whose contents are only available through accessors, or situations
where people want to manipulate how the object is represented when
Basically an application can define callbacks for controlling the Store and
Load process of a given YAML type/Perl type.
The callback API will be something like this:
- function: Store
registered by: Perl object name (blessing)
- Perl object reference (hash or array or possibly scalar)
- A serialization structure (hash/array/scalar)
- A YAML transfer URI
- function: Load
registered by: YAML URI (fully qualified or partially qualified)
- A deserialized YAML structure (hash/array/scalar)
- Perl object reference
Note that this does not let the user control exactly how the YAML is
formatted. It simply lets them specify the content and basic structure of the
serialization of any particular class.
Also note that it separates the YAML type (transfer) from the in memory type
(classname). So a user could make:
http://domination.ingerson.com/biggie -> DOM::I::Nation::Biggie
and vice versa.
I will also add functionality so that every Perl module can change the way
that its objects get serialized in YAML. For modules that are not yet
YAML-enabled, I will let the script writer be able to override.
No other Perl serializer comes close to this!
I think I will restrict users from defining transfers in the yaml.org domain.
This includes perl.yaml.org. For instance if Lincoln Stein wants to add YAML
support to CGI.pm, he should use "http://lds.cpan.org/CGI". (LDS is Lincoln's
CPAN id). If there is no special support for CGI it will default to
BTW, I'm going to switch around my default Perl transfer scheme again. It
http://perl.yaml.org/Foo # Foo object (type is autodetected)
http://perl.yaml.org/Foo:hash # If hash object is empty
http://perl.yaml.org/:glob # Special perl types
http://perl.yaml.org/Foo::Bar:glob # Blessed glob