| Version 2 (modified by ingy, 7 years ago) (diff) |
|---|
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...
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.
!!perl/object:Foo::Bar # object type is determined by Foo::Bar
These blessed forms could be shortened to:
!!perl/:Foo.Bar # Foo::Bar hash (can't use % in urls) !!perl/@Foo.Bar # Foo::Bar array !!perl/$Foo.Bar # Foo::Bar scalar !!perl/&Foo.Bar # Foo::Bar code !!perl/+Foo.Bar # Foo::Bar io !!perl/*Foo.Bar # Foo::Bar glob !!perl/\Foo.Bar # Foo::Bar reference !!perl/Foo.Bar # Foo::Bar object
The '!!perl' forms are only consumable by Perl. To share objects with Python, maybe use this form:
!!object:Foo.Bar
