Skip Menu |

This queue is for tickets about the REST-Google CPAN distribution.

Report information
The Basics
Id: 42031
Status: resolved
Priority: 0/
Queue: REST-Google

People
Owner: ejs [...] cpan.org
Requestors: Dave [...] WolfeWorks.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Why does responseData->results return a list?
Date: Mon, 29 Dec 2008 16:58:56 -0600
To: bug-REST-Google [...] rt.cpan.org
From: Dave Wolfe <Dave [...] WolfeWorks.net>
While using REST::Google::Search with Template Toolkit in Catalyst, I discovered that the responseData->results accessor returns a list of the (blessed) results instead of a reference to an array of (blessed) results. I consider this a bug since it makes it impossible to do something like: $res->responseData->results->[0]->{url} Turning an array reference into a list is easy, e.g.: @{$res->responseData->results} but turning the list into an array reference in, for example, TT is impossible. If I try to get the number of results in a template via the vmethod size, for example: response.results.size I always get the number of elements in the first 'results' hash (only the auto-promotion of the hash to a list prevents it failing with an error). The results accessor should do something like the following (note the encapsulating square brackets to create an anonymous array as the return value: return [ map {...} @{...} ]; -- Dave Wolfe
the defect is fixed. changes will appear in version 1.0.5 (uploaded recently)