- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- ADDING MEDIA
- BUGS
- DEVELOPERS
- AUTHOR
- BUGS
- SUPPORT
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 shortcode # i.e 123abc in 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 short code i.e 123abc in
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
AUTHOR
Simon Wistow,
<simon@thegestalt.org >
BUGS
Please report any bugs or feature requests to
bug-net-posterous::Poster.