[Developers] Stupid perl question

Kirrily Robert skud at infotrope.net
Wed Sep 12 23:45:11 UTC 2007


On 9/13/07, Paul Tomblin <ptomblin at xcski.com> wrote:
> 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
>   }
> };

Since this is query by example, if you want a list then you have to
ask for a list.  In this case:

my $query = [{ blah blah }];

I.e. just force the whole thing to be an anonymous listref.

I assume you're using my Metaweb.pm; the above should work fine for
it.  I need to work a bit on error messages from it, and make them a
bit more visible and perhaps Perl-appropriate.

K.


-- 
Kirrily Robert
skud at infotrope.net
http://infotrope.net


More information about the Developers mailing list