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

NAME

WWW::Instapaper::Client - An implementation of the Instapaper client API (see http://www.instapaper.com/api)

SYNOPSIS

        require WWW::Instapaper::Client;
        
        my $paper = WWW::Instapaper::Client->new(
                username        => 'myname@mydomain.com', # E-mail OR username
                password        => 'SooperSekrit',
        );
        
        my $result = $paper->add(
                url   => 'http://some.domain/path/to/page.html',
                title => "Page Title",  # optional, will try to get automatically if not given
                selection => 'Some text on the page', #optional
        );
        
        if (defined $result) {
                print "URL added: ", $result->[0], "\n";  # http://instapaper.com/go/######
                print "Title: ", $result->[1], "\n";      # Title of page added
        }
        else {
                # Must be an error
                warn "Was error: " . $paper->error . "\n";
        }

DESCRIPTION

This module is an implementation of the Instapaper API.

new
        my $paper = WWW::Instapaper::Client->new( %parameters );

Returns a new instance of this class, configured with the appropriate parameters. Dies if invalid parameters are provided.

Possible parameters are:

user_agent

The user agent ("browser") the server will see. Defaults to WWW-Instapaper-Client/$VERSION.

username

The Instapaper username. Often, but not always, an e-mail address. Defaults to $ENV{instapaper_user}

password

The password for the user's Instapaper account. The user may not have a password, in which case, any value works. Defaults to $ENV{instapaper_pass}

api_url

The base URL for the Instapaper API. Defaults to https://www.instapaper.com/api. You shouldn't need to change this unless you're connecting to a non-Instapaper service that uses the same API.

http_proxy, http_proxyuser, http_proxypass

The path to an HTTPS-capable proxy, and the username and password as appropriate. The standard HTTP_PROXY set of environment variables will work here; these are widely documented. You only need to specify these if you have a proxy AND you don't have the environment variables set.

add
        my $result = $paper->add(
                url       =>  'http://path.to/page',  # required
                title     =>  'Page title',           # optional
                selection =>  'Text from page',       # optional
        );
        
        if (defined $result) {
                print "URL added: ", $result->[0], "\n";  # http://instapaper.com/go/######
                print "Title: ", $result->[1], "\n";      # Title of page added
        }
        else {
                # Must be an error
                warn "Was error: " . $paper->error . "\n";
        }

Adds the specified page URL to Instapaper. If a title is not provided, Instapaper will attempt to acquire the title by retrieving the page; that is, we set auto-title = 1 for the Instapaper API when a title is not provided.

You may optionally provide text that represents a selection from the page.

If successful, add will return an ARRAYref containing the Instapaper "go" URL, and the page title as recorded by Instapaper.

If an error is encountered, add returns undefined and the error message is available in $paper-error()>.

authenticate
        $paper->authenticate or warn "Could not authenticate: ".$paper->error."\n";

Authenticates the user to Instapaper. This is useful to check that the credentials are valid before e.g. storing them for later use.

If successful, authenticate will return a true value.

If an error is encountered, authenticate returns undefined and the error message is available in $paper-error()>.

CHANGELOG

Release 0.9_001

Fixed dependency bug in Build.PL - forgot that Class::Base was required.

AUTHOR

Darren Meyer - DPMEYER on PAUSE

COPYRIGHT

(c) 2010 Darren Meyer (DPMEYER on PAUSE), and available under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 227:

'=item' outside of any '=over'

Around line 231:

You forgot a '=back' before '=head1'