WWW::KrispyKreme::Hotlight - first release
I have uploaded the first version of WWW::KrispyKreme::Hotlight. This is basically a Perl wrapper that interfaces with Krispy Kreme's location search page
Creating a new object like this:
# only supports geo right now my $donuts = WWW::KrispyKreme::Hotlight->new(where => [34.170833,-118.25]);
and calling the locations method like this:
my $locations = $donuts->locations;
will return a structure like this:
[ { 'storeHours2' => '', 'locationId' => '993', 'hotLightOn' => '0', 'storeHours1' => '', 'phone' => '818-955-9015', 'zipcode' => '91504', 'state' => 'CA', 'city' => 'Burbank', 'geoLocation' => '34.190000,-118.330000', 'url' => 'http://kkre.me/oXMuQQ', 'title' => 'Burbank', 'address' => '1521 North Victory Place' }, { 'storeHours2' => '', 'locationId' => '985', 'hotLightOn' => '0', 'storeHours1' => '', 'phone' => '323-291-4133', 'zipcode' => '90008', 'state' => 'CA', 'city' => 'Los Angeles', 'geoLocation' => '34.010000,-118.340000', 'url' => 'http://kkre.me/pF3cuI', 'title' => 'Los Angeles', 'address' => '4034 Crenshaw Boulevard' }, ... ]
Notice there is a boolean value for 'hotLightOn' which can be handy for finding fresh donuts!
CPAN: https://metacpan.org/module/WWW::KrispyKreme::Hotlight
Github: https://github.com/aggrolite/WWW-KrispyKreme-HotLight
Because its such a whimsical pursuit, I thought I would look a little deeper. I was interested to see the selection of modules you use to accomplish the task. Since you use Mojo::JSON, I thought I might try to demonstrate this entire scraper using the Mojolicious suite rather than using the URI/Mech/XML tools. The result is here though admittedly, I didn't update the build tools.
Certainly I won't fault you for using Moose (though this really could just be a function of lat and long). Since Mojolicious comes with Mojo::Base I use it here, though it is a VERY tiny object framework. Otherwise I use just the Mojolicious' built-in UserAgent, DOM parser and JSON functionalities. Further, the method call could be made entirely non-blocking since Mojolicious and its tools will operate that way if so constructed.
I hope you know, I'm not at all criticizing, just showing another, and in my view simpler, way of accomplishing this fun task. Cheers!
I just saw your fork on github, it looks nice! Thanks for the feedback also. I am very unfamiliar with the Mojo::* modules except for Mojo::JSON, which might explain why mine has so many dependencies. I will take a closer look at your changes. :-)