NAME

Net::PingFM - Interact with ping.fm from perl

SYNOPSIS

# Make pingfm object with our user and api keys:
my $pfm = Net::PingFM->new( user_key => 'blah',
                           api_key => 'foo' );

# check they like our keys (you don't need to do this!)
$pfm->user_validate or die 'Couldn\'t log in to ping.fm!';

# make a post using our default method:
$pfm->post( 'Hello ping.fm!' );

# make a microblog post:
$pfm->post( 'Testing Net::PingFM' , { method => 'microblog' } );

# make a real blog post, with title and everything!
$pfm->post( 'Testing Net::PingFM. Hours of fun..',
            { method => 'blog', title => 'Testing Testing!'} );

# get the list of services for the account:
my @services = $pfm->services;

DESCRIPTION

Simple little module for posting to http://ping.fm/

STATUS

Currently the library can do basic posting to different services, and that's about it!

CONSTRUCTOR

Your user and application keys are required). Module will die without them.

my $pfm = Net::PingFM->new( api_key => 'blah', user_key => 'blah' );

The API key is your developer api key which you get from ping.fm and is associated with your app, and the user key is the key to authenticate you with a particular account. See the api docs for more details.

Additional constructor parameters:

  • debug_mode => 1, # will stop posts from actually appearing

  • dump_responses => 1 # will cause us to print our XML responses for debug

METHODS

user_validate

if ( $pfm->user_validate ){
   # we have a valid user key
}
else{
  # we don't!
}

Validate the user's application key. Returns true value if the user key is OK and false otherwise.

post

$pfm->post( $body , \%optional_params );
$pfm->post( 'Hacking on Net::PingFM', { post_method => 'status' });
$pfm->post( 'Posting using my default method' );
$pfm->post( 'Hacking on Net::PingFM, don\'t tell facebook', { service => 'twitter' });

Make a post! We at least need a $body which is the body of the post we'll send to ping.fm.

Optional parameter hashref can contain:

  • post_method => What you would like to post to.

  • method => shorthand for post_method

    Valid post_method's are blog, microblog, status and default. Default will use your default post method on ping.fm. Default is our default! 'method' is a less cumbersome option to type, if for some reason you choose to use both parameters then 'post_method' is the one which will be used.

  • title => The title for the post. Ping.fm requires this for post_method 'blog' but we don't enforce that in the module!

  • service => Just post to one service. Fot the value use the service id or a Net::PingFM::Service object.

trigger_post

$pfm->trigger_post( $trigger, $body, $opts );
$pfm->trigger_post( 'tw', 'Testing Ping.fm triggers!' );

Post to a "ping.fm" trigger. The $trigger can be a trigger id (as in the textual id of the trigger) or a Net::PingFM::Trigger object

services

my @services = $pfm->services;

Get a list of services for this account.

Returns a list of Net::PingFM::Service objects

triggers

Grab the list of "triggers" from ping.fm. These allow you to post to your ping.fm groups, allowing you to post to multiple services at once.

Returns a list of Net::PingFM::Trigger objects describing the triggers.

last_error

Last error message we were sent from ping.fm

ERROR HANDLING

If something goes wrong at the network or XML parsing level the methods will die. If things go wrong at the API level, as in ping.fm gives us an actual error then the method will generally return false and set last_error with an error message from ping.fm.

MOOSE!

This is implemented using moose, so can be messed with in a moosey way if you feel like it!

API INFO

http://groups.google.com/group/pingfm-developers/web/api-documentation

DEVELOPMENT

Follow development of this library (and or fork it!) on github:

http://github.com/draxil/net-pingfm/

AUTHOR

Joe Higton

COPYRIGHT

Copyright 2008 Joe Higton

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