On Sat, 6 Jul 2013 17:59:21 -0700
Rik Brown <[email protected]> wrote:

> Of course you could also do:
> 
> { 
>   results => \@sendArray
> }
> 
> if you want your output to be a hash at the top level.
> 
> Hope this helps! 

Rik's answer above is the course of action I'd typically recommend
- because even if you just want the array for now, in future you may
well decide you want to provide other information from that call, too
(perhaps be able to return an error message as a key named 'error', or
return the number of results found as a key named 'count', or return
the average of all the values... etc) - so returning a hashref as Rik
illustrates helps with future-proofing, as you could easily add more
information to the response without breaking existing code.



-- 
David Precious ("bigpresh") <[email protected]>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github


_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to