Net-FireEagle
view release on metacpan or search on metacpan
bin/fireeagle view on Meta::CPAN
#!perl -w
use strict;
use Net::FireEagle;
use JSON::Any;
my $CONFIG = $ENV{HOME}."/.fireeagle";
=head1 NAME
fireeagle - simple FireEagle client
=head1 USAGE
# to get your user tokens
fireeagle consumer_key=<consumer key> consumer_secret=<consumer secret>
# to get your current location
fireeagle consumer_key=<consumer key> consumer_secret=<consumer secret> \
access_token=<access token> access_token_secret=<access token secret>
# to set your current location
fireeagle consumer_key=<consumer key> consumer_secret=<consumer secret> \
access_token=<access token> access_token_secret=<access token secret> \
update <location>
or if there is a .fireeagle file in your home directory that looks like
consumer_key=<consumer key>
consumer_secret=<consumer secret>
access_token=<access token>
access_token_secret=<access token secret>
then to get your current location
fireeagle
and to set your current location
fireeagle update <location>
or to search for a location
fireeagle lookup <location>
or you can mix and match command line options and config file options
(command line will always override config file).
=head1 AUTHENTICATION AND USER TOKENS
To use this script or the C<Net::FireEagle> module you'll need to
get an application key. This script will require a desktop type key.
The C<Net::FireEagle> documentation has more information on this but,
in short, read this page
http://fireeagle.yahoo.net/developer/documentation/getting_started
=head1 ABOUT
Fire Eagle is a site that stores information about your location. With
your permission, other services and devices can either update that
information or access it. By helping applications respond to your
location, Fire Eagle is designed to make the world around you more
interesting! Use your location to power friend-finders, games, local
information services, blog badges and stuff like that...
You can find out more about it here
https://fireeagle.yahoo.net/
=cut
binmode STDOUT, ":utf8";
my %tokens = get_tokens();
error("You must pass in a consumer key and secret")
unless (defined $tokens{consumer_key} && defined $tokens{consumer_secret});
error("You can't just pass an access token and no access token secret")
if (defined $tokens{access_token} && !defined $tokens{access_token_secret});
error("You can't just pass an access token secret and no access token")
if (!defined $tokens{access_token} && defined $tokens{access_token_secret});
# create the FireEagle object
my $fe = Net::FireEagle->new( %tokens );
# we've got everything we need to interact
if ($fe->authorized) {
my $method = lc(shift @ARGV);
if (defined $method && $method !~ m!^\s*$! && $method ne 'location') {
my $loc = shift @ARGV || die "You must pass a location to method $method\n";
if ($method eq 'lookup') {
lookup_location($fe, $loc);
} elsif ($method eq 'update') {
update_location($fe, $loc);
} else {
die "Unknown method $method\n";
}
}
print "Current location: ".get_location($fe)."\n";
exit 0;
}
# right, we need to get their access stuff
print "STEP 1: REQUEST FIREEAGLE AUTHORIZATION FOR THIS APP\n";
print "\tURL : ".$fe->get_authorization_url( callback => 'oob' )."\n";
print "\n-- Please go to the above URL and authorize the app";
print "\n-- It will give you a code. Please type it here: ";
my $verifier = <STDIN>; print "\n";
chomp($verifier);
( run in 0.810 second using v1.01-cache-2.11-cpan-39bf76dae61 )