Skip Menu |

This queue is for tickets about the Net-WhitePages CPAN distribution.

Report information
The Basics
Id: 37381
Status: resolved
Priority: 0/
Queue: Net-WhitePages

People
Owner: Nobody in particular
Requestors: WMCKEE [...] cpan.org
Cc:
AdminCc:

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



Subject: Helper method
Thanks, very useful library. A nice helper method would be a method that returns true or false to indicate if data was found. William -- Knowmad Technologies http://www.knowmad.com
Subject: Re: [rt.cpan.org #37381] Helper method
Date: Fri, 4 Jul 2008 10:28:42 -0400
To: William McKee via RT <bug-Net-WhitePages [...] rt.cpan.org>
From: Darren Chamberlain <dlc [...] sevenroot.org>
* William McKee via RT <bug-Net-WhitePages at rt.cpan.org> [2008/07/03 23:56]: Show quoted text
> Thanks, very useful library. A nice helper method would be a method > that returns true or false to indicate if data was found.
I hope it's useful for you. I'm not sure how useful that method would be, since the module is currently set up to be stateless, i.e., if you request info on the same number 4 times, it makes 4 queries. Maybe if reverse_phone, find_person, and reverse_address returned some kind of response object, you could query that, but right now it's not complicated enough to do that. The data structure that comes back from the lookup methods is exactly as defined in the developer docs (see http://developer.whitepages.com/docs), so in the case of empty result, the {'result'}->{'code'} element would contain "No Data Found", and the {'meta'}->{'recordrange'}->{'totalavailable'} element would be 0. Hm, now that I'm reading what I just wrote, I think there might be a call for a Response object, possibly with an internal cache. As soon as I find some time, I'll code this up and release a new version. (darren) -- Which of us is not forever a stranger and alone? -- Thomas Wolfe
Download (untitled)
application/pgp-signature 197b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #37381] Helper method
Date: Fri, 4 Jul 2008 11:41:05 -0400
To: Darren Chamberlain via RT <bug-Net-WhitePages [...] rt.cpan.org>
From: William McKee <william [...] knowmad.com>
On Fri, Jul 04, 2008 at 10:29:10AM -0400, Darren Chamberlain via RT wrote: Show quoted text
> methods is exactly as defined in the developer docs (see > http://developer.whitepages.com/docs), so in the case of empty result, > the {'result'}->{'code'} element would contain "No Data Found", and > the {'meta'}->{'recordrange'}->{'totalavailable'} element would be 0.
I was using result->code but hadn't noticed the totalavailable element yet. Thanks for that tip. Show quoted text
> Hm, now that I'm reading what I just wrote, I think there might be a > call for a Response object, possibly with an internal cache. As soon > as I find some time, I'll code this up and release a new version.
Cool. Caching is the next thing I've been thinking about to reduce requests to the server. I was thinking of a cache mechanism that uses Storable or SQLite to support non-persistent applications like cgi scripts. Thanks, William -- Knowmad Technologies - Open Source Software Solutions W: http://www.knowmad.com | E: william@knowmad.com P: 704.343.9330 | http://www.LinkedIn.com/in/williammckee
Subject: Re: [rt.cpan.org #37381] Helper method
Date: Fri, 4 Jul 2008 13:36:36 -0400
To: "william [...] knowmad.com via RT" <bug-Net-WhitePages [...] rt.cpan.org>
From: Darren Chamberlain <dlc [...] sevenroot.org>
* william at knowmad.com via RT <bug-Net-WhitePages at rt.cpan.org> [2008/07/04 13:28]: Show quoted text
> On Fri, Jul 04, 2008 at 10:29:10AM -0400, Darren Chamberlain via RT wrote:
> > Hm, now that I'm reading what I just wrote, I think there might be > > a call for a Response object, possibly with an internal cache. As > > soon as I find some time, I'll code this up and release a new > > version.
> > Cool. Caching is the next thing I've been thinking about to reduce > requests to the server. I was thinking of a cache mechanism that > uses Storable or SQLite to support non-persistent applications like > cgi scripts.
This would be pretty simple with Cache::Cache: use Net::WhitePages; use Cache::FileCache; my $wp = Net::WhitePages->new; my $cache = Cache::FileCache->new; my $phone = '2125551212'; my $person = $cache->get($phone); unless ($person) { $person = $wp->reverse_phone(phone => $phone); $cache->set($phone, $person, "60 minutes"); } print $person; (That's adapted from http://search.cpan.org/dist/Cache-Cache/lib/Cache/Cache.pm, and is untested.) -- Capitalism is the extraordinary belief that the nastiest of men, for the nastiest of reasons, will somehow work for the benefit of us all. -- John Maynard Keynes
Download (untitled)
application/pgp-signature 197b

Message body not shown because it is not plain text.