Net-MyOpera
view release on metacpan or search on metacpan
lib/Net/MyOpera.pm view on Meta::CPAN
1;
__END__
=pod
=head1 NAME
Net::MyOpera - a Perl interface to the My Opera Community API
=head1 SYNOPSIS
Example:
use Net::MyOpera;
my $myopera = Net::MyOpera->new(
consumer_key => '{your-consumer-key-here}',
consumer_secret => '{your-consumer-secret-here}',
);
my $result = $myopera->update('If you see this, OAuth worked!');
In reality, it's a bit more complicated than that, but look at the
example script provided in C<examples/myopera-status>. That should
work out of the box.
=head1 DESCRIPTION
This module will be useful to you if you are a member of, or you
use, the My Opera Community (L<http://my.opera.com>).
There's a nice development plan for this code. For now, you can
set your own My Opera status, which is of course really awesome on
its level :-)
If you know how L<Net::Twitter> works, then you will have no problem
using L<Net::MyOpera> because it behaves in the same way, and
in fact, it's even API compatible. The API is based on OAuth.
If you're not familiar with OAuth, go to L<http://oauth.net> and
read the documentation there. There's also some very nice
tutorials out there. Search for C<"OAuth tutorial"> in your
favorite search engine.
That means that if you use the provided example script, in the
C<examples/myopera-status> file, just by instancing L<Net::Twitter>
instead of L<Net::MyOpera>, and changing the API keys of course,
you should be able to update your Twitter status as well.
To use this module, B<you will need your set of OAuth API keys>.
To get your own OAuth consumer key and secret, you need to go to:
https://auth.opera.com/service/oauth/
where you will be able to B<sign up to the My Opera Community>
and B<create your own application> and get your set of consumer keys.
If you don't want to do it, you can use (temporarily) use the
Test application keys, for command line/desktop based applications:
Consumer key: test_desktop_key
Consumer secret: p2FlOFGr3XFm5gOwEKKDcg3CvA4pp0BC
=head1 SUBROUTINES/METHODS
=head2 CLASS CONSTRUCTOR
=head3 C<new( %args )>
Class constructor.
There's two, both mandatory, arguments,
B<consumer_key> and B<consumer_secret>.
Example:
my $myopera = Net::MyOpera->new(
consumer_key => '...',
consumer_secret => '...',
);
To get your own consumer key and secret, you need to head over to:
https://auth.opera.com/service/oauth/
where you will be able to sign up to the My Opera Community
and create your own application and get your set of consumer keys.
If you don't want to do it, you can use (temporarily) use the
Test application keys, for command line/desktop based applications:
Consumer key: test_desktop_key
Consumer secret: p2FlOFGr3XFm5gOwEKKDcg3CvA4pp0BC
=head2 INSTANCE METHODS
=head3 C<access_token()>
=head3 C<access_token($new_value)>
=head3 C<access_token_secret()>
=head3 C<access_token_secret($new_value)>
=head3 C<consumer_key()>
=head3 C<consumer_key($new_value)>
=head3 C<consumer_secret()>
=head3 C<consumer_secret($new_value)>
=head3 C<request_token()>
=head3 C<request_token($new_value)>
=head3 C<request_token_secret()>
=head3 C<request_token_secret($value)>
All of these are simple accessors/mutators, to store access token and secret data.
This store is volatile. It doesn't get saved on disk or database.
=head3 C<authorized()>
Returns true if you already have a valid access token that's also
authorized. If not, you will need to get a request token.
You need to be familiar with the OAuth protocol flow.
Refer to L<http://oauth.net/>.
=head3 C<get_authorization_url()>
Returns the URL that a user can use to authorize the request token.
Under the hood, it first requests a new request token.
=head3 C<oauth_url_for($oauth_phase)>
=head3 C<oauth_url_for($oauth_phase, %arguments)>
Internal method to generate URLs towards the Opera OAuth server.
=head3 C<request_access_token( verifier => $verifier )>
When the request token is authorized by the user, the user will
be given a "verifier" code. You need to have the user input the
verifier code, and use it for this method.
In case of success, this method will return you both the
OAuth access token and access token secret, which you
will be able to use to finally perform the API requests,
namely status update.
( run in 1.008 second using v1.01-cache-2.11-cpan-39bf76dae61 )