SPUG: JSYNC-0.03 for Perl
Ingy dot Net <[email protected]>
| Newsgroups | gmane.comp.lang.perl.perl-mongers.seattle,gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Greetings,
I have a not totally useless Perl implementation of JSYNC.pm on CPAN and
GitHub now.
- http://search.cpan.org/dist/JSYNC/
- http://github.com/ingydotnet/jsync-pm
It is passing these 6 data driven roundtripping tests, which should be
easily grokkable:
http://github.com/ingydotnet/jsync-pm/blob/master/t/jsync-yaml.tml
Here is the (reasonably small amount of) source code:
http://github.com/ingydotnet/jsync-pm/blob/master/lib/JSYNC.pm
It has a dump() and a load() function. dump() takes a Perl object, makes a
full clone in the JSYNC/JSON style, and JSON encodes it. load() takes a
JSYNC string, JSON decodes it, and makes a full clone to a native Perl
object.
The full clone in both directions seems a bit heavy handed, but I think it
is too soon to make premature optimizations. I want to get a common test
suite passing in several languages, and then think about optimization
refactoring.
The tests point out that it might be a good time to revisit the default tags
for objects. Having the term 'perl' in there will surely not pass on Python,
etc. The Python defaults are also not portable.
Enjoy, Ingy
_____________________________________________________________
Seattle Perl Users Group Mailing List
POST TO: [email protected]
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
MEETINGS: 3rd Tuesdays
WEB PAGE: http://seattleperl.org/