
WWW::Foursquare - is a Perl wrapper for the Foursqauare API.

This document describes WWW::Foursquare version 0.9905

use WWW::Foursquare;
# Create fs object my $fs = WWW::Foursquare->new( client_id => 'client_id', client_secret => 'client_secret', redirect_uri => 'redirect_uri', );
# Set access_token my $access_token = 'XXXX'; $fs->set_token($access_token);
# Search users by name my $search_users = eval { $fs->users()->search(name => 'Pavel Vlasov') };
if (not $@) {
# work with result in Perl structure
# print Dumper($search_users);
}
else {
# process errors
warn $@ if $@;
}

This wrapper help you send requests to Foursquare API and get result in easy way, OAuth is supported, quick integration with your current project. You can get more information about Foursquare API here: https://developer.foursquare.com/

How to connect your apps with foursquare via OAuth 2.0.
https://foursquare.com/developers/apps Get Client ID, Client Secret and Callback url my $fs = WWW::Foursquare->new( client_id => 'client_id', client_secret => 'client_secret', redirect_uri => 'redirect_uri', );
my $auth_url = $fs->get_auth_url();
It looks like this: https://foursquare.com/oauth2/authenticate?client_id=client_id&redirect_uri=redirect_url&response_type=code
Implement callback in your server.
- You click on auth url to go to autorize page.
- If authorization is successful you will redirect to callback url and get code.
- Then you use this code for getting access_token for Foursquare API
http://your_server.com/callback&code=XXXXXXX
my $code = ... # getting code here
Allow app to access to your account in foursquare
my $access_token = $fs->get_access_token($code);
Background magic will send GET request to Foursquare API
$fs->set_access_token($access_token);
For more information I would recommend you visit page https://developer.foursquare.com/overview/auth

my $fs = WWW::Foursquare->new(
debug => 1,
);

Creating a new foursquare object.
my $fs = WWW::Foursquare->new(
client_id => 'client_id',
client_secret => 'client_secret',
redirect_uri => 'redirect_uri',
);
Prepare auth url from Foursquare parameters (cliend_id, redirect_uri)
my $auth_url = $fs->get_auth_url();
Get code after redirect, and send GET request to fetch access token
my $access_token = $fs->get_access_token($code);
Set access token for foursquare object
All users methods: https://developer.foursquare.com/docs/users/users If you want to use itself method for forsquare API: $fs->users->info(); # get info about users etc
All venues methods: https://developer.foursquare.com/docs/venues/venues
All venuegroups methods: https://developer.foursquare.com/docs/venuegroups/venuegroups
All checkins methods: https://developer.foursquare.com/docs/checkins/checkins
All tips methods: https://developer.foursquare.com/docs/tips/tips
All lists methods: https://developer.foursquare.com/docs/lists/lists
All updates methods: https://developer.foursquare.com/docs/updates/updates
All photos methods: https://developer.foursquare.com/docs/photos/photos
All settings methods: https://developer.foursquare.com/docs/settings/settings
All specials methods: https://developer.foursquare.com/docs/specials/specials
All campaigns methods: https://developer.foursquare.com/docs/campaigns/campaigns
All events methods: https://developer.foursquare.com/docs/events/events
All pages methods: https://developer.foursquare.com/docs/pages/pages
All pageupdates methods: https://developer.foursquare.com/docs/pageupdates/pageupdates

You can see examples how to use WWW::Foursquare. Here: /eg/test.pl

Pavel Vlasov, <fxzuz at cpan.org>

Please report any bugs or feature requests to bug-www-foursquare at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Foursquare. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc WWW::Foursquare
You can also look for information at:

Copyright 2012 Pavel Vlasov.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.