[Developers] Stupid perl question

Christopher R. Maden crism at metaweb.com
Wed Sep 12 22:05:08 UTC 2007


Paul Tomblin wrote:
> I forgot to mention that is wrapped in:
 >
> my $envelope = { # This is the outer envelope object
>   waypointQuery => {
>     query =>  $query  # The "query" property of inner envelope holds query
>   } # End of inner envelope
> }; # End of outer envelope
> 
> No, that doesn't do anything.  Oh, but changing the "query =>" line to 
>     query => [ $query ]
> works.  Funny, I thought I'd tried that already.  Thanks for the hint.

No problem.

I might make this a little more flexible for handling single vs. 
multiple queries, perhaps:

my $query = { ... };

or

my $query = [ ... ];

as appropriate, and then

my $envelope = {
   waypointQuery => {
     query =>  $query
   }
};

should handle either case correctly.

You will also need to inspect the results, if you take that approach, to 
determine if the response is singular or plural, but that’s pretty 
straightforward.

~Chris
-- 
Christopher R. Maden
Data Architect
Metaweb Technologies, Inc.
<URL: http://www.metaweb.com/ >


More information about the Developers mailing list