[Developers] Perl API - just to make things confusing
Michael Jones
szaijan at gmail.com
Fri Aug 24 17:43:11 UTC 2007
I haven't been able to look at Kirrily's work yet, but I like the
direction Hayden is going. The syntax and method structure are
extremely functional and I don't have a lot to add to the basic
query/response methods. Nice work you two!
I do have a minor caveat. When I wrote my metaweb module, I ran into
an issue with the JSON serializer where "name" property values that
consist only of numbers (as in topics that are named after years, i.e.
'2007') would not be quoted, and Metaweb would issue an error because
it expected a string. If you're using the JSON.pm Perl library,
you'll likely face the same issue. I patched it by simply using a
substitution for name property values in the JSON string, but a more
generalized approach is called for.
Also, some thoughts for utility methods that I end up using frequently
in control statements, where compact notation is desireable:
1) A test for the existence of an instance sought by a query, i.e.
&exists( $q ), returns the number of instances found, 0 if none are found
2) As above, but tests for a unique instance:
&unique( $q ), returns true if only one instance is found, 0 otherwise
3) Get a set properties for a given type or set of types
&get_properties( $type1 [, $type2, ... ] )
- returns an array or list of fully qualified property names
4) some sets of types' props could lead to duplicate properties,
especially if a type
includes another type in the set. So, versions of the above that
get a hash instead
of a list are useful, using the prop names as keys to eliminate duplication.
In addition, versions that get back a hash or list of objects that
include the expected
value type as well as the property name could prove useful.
____________________________________________________________________
Michael Jones, Gamer at Large
szaijan at ternea.com
____________________________________________________________________
More information about the Developers
mailing list