开发者

passing a data structure from java to perl (and vice versa)

A few days ago I asked about passing a data structure from java to perl and vice versa, and one of the recos was JSON. I played with it (mainly using Gson for java) and it seems quite nice. The only problem is I have references inside my data structure (to other objects inside the same data structure). Currently, each such reference is "translated" fully so actually each object is duplicated many times, and you can't tell all those references pointed to the same object.

Is there someway to pass info from ja开发者_运维问答va to per and vice versa, preferably in a human readable format, that also keeps the data about references instead duplicating values?


Similar to JSON is "YAML", and YAML allows for exactly what you describe. I believe that there's a YAML parser for Perl and I know there's one for Java because I use it in a current application.

http://yaml.org/


I would suggest Inline::Java for accessing Java class from Perl and vice versa,. Once you have that interface running, you can easily access methods and attributes from the class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜