The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::MyOpera - a Perl interface to the My Opera Community API

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 examples/myopera-status. That should work out of the box.

DESCRIPTION

This module will be useful to you if you are a member of, or you use, the My Opera Community (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 Net::Twitter works, then you will have no problem using 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 http://oauth.net and read the documentation there. There's also some very nice tutorials out there. Search for "OAuth tutorial" in your favorite search engine.

That means that if you use the provided example script, in the examples/myopera-status file, just by instancing Net::Twitter instead of Net::MyOpera, and changing the API keys of course, you should be able to update your Twitter status as well.

To use this module, 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 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

SUBROUTINES/METHODS

CLASS CONSTRUCTOR

new( %args )

Class constructor.

There's two, both mandatory, arguments, consumer_key and 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

INSTANCE METHODS

access_token()

access_token($new_value)

access_token_secret()

access_token_secret($new_value)

consumer_key()

consumer_key($new_value)

consumer_secret()

consumer_secret($new_value)

request_token()

request_token($new_value)

request_token_secret()

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.

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 http://oauth.net/.

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.

oauth_url_for($oauth_phase)

oauth_url_for($oauth_phase, %arguments)

Internal method to generate URLs towards the Opera OAuth server.

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.

request_request_token()

Requests and returns a new request token. First step of the OAuth flow. You can use this method also to quickly check that your set of API keys work as expected.

If they don't work, the method will croak (die badly with an error message).

update($new_status)

Updates your My Opera status with the $new_status string. You must be authorized first. Check the authorized() method and/or the OAuth documentation at http://oauth.net/.

AUTHOR

Cosimo Streppone, <cosimo@opera.com>

BUGS

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

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Net::MyOpera

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (c), 2009-2010 Opera Software ASA. All rights reserved.