[Developers] Stupid perl question

Paul Tomblin ptomblin at xcski.com
Wed Sep 12 21:01:37 UTC 2007


How do I do a query in perl that returns all the items of a particular
type?

I'm trying to adapt the code in 4.1.1. in the "Developing Metaweb-Enabled
Web Applications"[1], but I can't figure out how to specify multiple
returns?  My query currently looks like:

my $query = {
  type => "/user/ptomblin/default_domain/waypoint",
  name => undef,
  aviationid => undef,
  id => undef,
  state_province => undef,
  waypoint_type => undef,
  "/location/location/geolocation" => {
    latitude => undef,
    longitude => undef
  }
};

But I get back "/api/status/error/mql/result: Unique query may have at
most one result. Got 5 at ./getWaypoints.pl line 66."

In the query editor, the following works:
{
  "query":[{
    "/location/location/geolocation":{
      "latitude":null,
      "longitude":null
    },
    "aviationid":null,
    "id":null,
    "name":null,
    "state_province":null,
    "type":"/user/ptomblin/default_domain/waypoint",
    "waypoint_type":null
  }]
}
but I can't translate that into perl.

[1] BTW: Somebody needs to do a search and replace in that document
because it keeps saying "/mql/status" where it should say "/api/status".

-- 
Paul Tomblin <ptomblin at xcski.com> http://blog.xcski.com/
"The thing you don't check is the thing that will kill you." 
                -- Rick Grant (quoting RCAF pilot training)


More information about the Developers mailing list