Changes between Version 2 and Version 3 of PerlTagScheme
- Timestamp:
- 05/13/06 13:52:20 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PerlTagScheme
v2 v3 1 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. 2 1 3 These are the unblessed Perl basic types: 2 4 … … 20 22 }}} 21 23 22 There could be a form that requires there to be a class in memory to handle it. If there is no Foo::Bar class, an exception is thrown. 24 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. 25 26 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. 23 27 24 28 {{{ 25 !!perl/object:Foo::Bar # object type is determined by Foo::Bar 29 !!perl/object:Foo::Bar 30 !!perl/:Foo::Bar 31 !!perl/Foo::Bar 26 32 }}} 27 33 28 These blessed forms could be shortened to: 29 30 {{{ 31 !!perl/:Foo.Bar # Foo::Bar hash (can't use % in urls) 32 !!perl/@Foo.Bar # Foo::Bar array 33 !!perl/$Foo.Bar # Foo::Bar scalar 34 !!perl/&Foo.Bar # Foo::Bar code 35 !!perl/+Foo.Bar # Foo::Bar io 36 !!perl/*Foo.Bar # Foo::Bar glob 37 !!perl/\Foo.Bar # Foo::Bar reference 38 !!perl/Foo.Bar # Foo::Bar object 39 }}} 34 Note: the first form, while more verbose, more closely matches what Python and Ruby do. (I think) See [wiki:http://pyyaml.org/wiki/PythonTagScheme]. 40 35 41 36 The '!!perl' forms are only consumable by Perl. To share objects with Python, maybe use this form: … … 44 39 !!object:Foo.Bar 45 40 }}} 46
