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

NAME

Net::Posterous - read and post from Posterous blogs

SYNOPSIS

    my $api   = Net::Posterous->new($user, $pass);
    
    # Get a list of sites the user owns as Net::Posterous::Site objects
    my @sites = $api->get_sites;
    
    # Set the site to use
    $api->site($sites[0]); 

    # Create a post 
    my $post = Net::Posterous::Post->new(%opts);
    my $res  = $api->post($post);
    
    # Update the post
    $post->title("New Title");
    my $res  = $api->post($post);
    
    # Get a list of posts
    my @posts = $api->get_posts;
    
    # Get an individual post using the http://post.ly shortcode
    # i.e 123abc in http://post.ly/123abc
    my $post  = $api->get_post($post->short_code);
    
    
    # Get a list of tags
    my @tags  = $api->get_tags;
    
    # Create a post with an video attached
    my $video = Net::Posterous::Media::Local->new(file => $path_to_movie);
    my $vpost = Net::Posterous::Media::Post->new( title => "My movie", media => $video );
    my $res   = $api->post($vpost);
    
    # Create a post with a flipbook of pictures
    my @images = map {  Net::Posterous::Media::Local->new(file => $_) } qw(1.jpg 2.jpg 3.jpg);
    my $ipost  = Net::Posterous::Media::Post->new( title => "My flipbook", media => \@images );
    my $res    = $api->post($ipost);
    
    # Add a comment
    my $comment = Net::Posterous::Comment->new( body => "Nice flipbook!" );
    my $res     = $api->comment($ipost, $comment);
    
    
    

DESCRIPTION

This allows reading a writing from Posterous sites.

It's very similar to the Posterous module but:

It doesn't require Perl 5.10
It's slightly more user friendly
It's more CPAN namespace friendly

METHODS

new <username> <password> [site]

Create a new client object.

Requires a username and a password.

Optionally you can pass in either a site id or a Net::Posterous::Site object to specify which site to read/write from.

If it's not passed in then it can be passed in later or your default site will be used.

site [site]

Get or set the current site being used.

May return undef.

site_from_id <id>

Return a Net::Posterous::Site object based on a site id.

Returns undef if the site can't be found.

get_sites

Get a list of all the user's sites.

get_posts [opt[s]]

Get the posts from a site.

Uses, in order - the site passed in using the option key site, the site set by the user, the default site.

The options are

site_id

The id of the site to read from

hostname

Subdomain of the site to read from

num_posts

How many posts you want. Default is 10, max is 50.

page

What 'page' you want (based on num_posts). Default is 1

tag

Only get items with this tag.

get_post <short code>

Get an id via the http://post.ly short code i.e 123abc in http://post.ly/123abc

get_tags [opt[s]]

Get a list of tags for a site.

Uses, in order - the site passed in using the option key site, the site set by the user, the default site.

The options are

site_id

Optional. Id of the site to read from

hostname

Optional. Subdomain of the site to read from

post <post> [opt[s]]

Post or update a Net::Posterous::Post or <Net::Posterous::Media> object.

Uses, in order - the site passed in using the option key site, the site set by the user, the default site.

comment <post> <comment>

Add a comment to the post.

error

Get or set the last error

ADDING MEDIA

The way to add media is to create a new Net::Posterous::Media::Local file and then add that to the Net::Posterous::Post object that's going to be created or updated.

It will then be turned into a proper Net::Posterous::Media object when the Post is retrieved.

BUGS

The Posterous API docs mention being able to post "common document formats" but there's no docs for it.

I'll add it when I come across it.

DEVELOPERS

The latest code for this module can be found at

    https://svn.unixbeard.net/simon/Net-Posterous

AUTHOR

Simon Wistow, <simon@thegestalt.org >

BUGS

Please report any bugs or feature requests to bug-net-posterous at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Posterous. 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::Posterous

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2010 Simon Wistow, all rights reserved.

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