looking for some kind of IDL for Perl types only

T

Ted Zlatanov

I'm trying to describe a function's data interface through a simple JSON
language (a sort of DSL). Yes, this is a lot like an IDL. For instance
this interface takes a boolean "activated" parameter and a "users" hash
with mandatory and optional keys as shown.

{
"activated": { "type": "boolean" },

"users":
{
# "stringmap" has only string keys
"type": "stringmap",
"keys":
{
"gecos" : "string",
"uid" : "integer",
"home" : "string",
"shell" : "string"
},
"optional_keys":
{
"passwdhash" : "string",
"groupname" : "string",
"_allow_dup_gid" : "boolean",
"_enforce" : "boolean",
"_nocreate_home" : "boolean",
"_noseed" : "boolean"
}
}
}

I am not attached to the JSON-based DSL, it's just my first prototype.

Parsing and validating the DSL strikes me as boring and surely something
that has been done before, but I'm not crazy about using existing IDLs
like Protocol Buffers, Thrift IDL, WSDL, or the Avro IDL
(http://avro.apache.org/docs/current/idl.html) because they are all too
complex. SWIG is too C-oriented, and so on.

I'd rather have something very simple and easy to parse, which only
supports the basic pure data types in Perl (strings, integers, floating
point, booleans) and lists and hashes that use those data types. I
don't want custom data types. Does such a beast exist in CPAN or
Perl-land? Ideally I should be able to pass it an interface definition
and the actual data, and it should tell me if there's a problem and
where.

Thanks
Ted
 
B

Bjoern Hoehrmann

* Ted Zlatanov wrote in comp.lang.perl.misc:
I'm trying to describe a function's data interface through a simple JSON
language (a sort of DSL). Yes, this is a lot like an IDL. For instance
this interface takes a boolean "activated" parameter and a "users" hash
with mandatory and optional keys as shown.

You might be looking for said:
I'd rather have something very simple and easy to parse, which only
supports the basic pure data types in Perl (strings, integers, floating
point, booleans) and lists and hashes that use those data types. I
don't want custom data types. Does such a beast exist in CPAN or
Perl-land? Ideally I should be able to pass it an interface definition
and the actual data, and it should tell me if there's a problem and
where.

(I do not know how mature the JSON Schema implementations in Perl are.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top