|Version 5 (modified by anonymous, 8 years ago) (diff)|
Tags in the form of '!perl/...' have a full form of <tag:yaml.org,2002:perl/...>. This implies that implementation that use '!perl/...' for tagging, should strive to stick with in the confines described in this document.
These are the unblessed Perl basic types:
!perl/hash # hash reference !perl/array # array reference !perl/scalar # scalar reference !perl/code # code reference !perl/io # io reference !perl/glob # a glob (not a ref) !perl/regexp # a regexp (not a ref) !perl/ref # a container ref to any of the above
All of the above types can be blessed:
!perl/hash:Foo::Bar # hash ref blessed with 'Foo::Bar' !perl/glob:Foo::Bar # glob blessed with 'Foo::Bar' etc...
A YAML Loader that sees a form like that above, will simply bless the referent to create the object. The 'Foo::Bar' class' YAML API will not be called.
There also needs to be a standard tag form for a class which implements its own yaml API. In this case, YAML Loader will throw an exception if there is no class to load the object. The following options are under consideration.
!perl/object:Foo::Bar !perl/:Foo::Bar !perl/Foo::Bar
Note: the first form, while more verbose, more closely matches what Python and Ruby do. (I think) See PythonTagScheme.
The '!perl' forms are only consumable by Perl. To share objects with Python, maybe use this form: