=head1 NAME Mojo::FriendFeed - A non-blocking FriendFeed listener for Mojolicious =head1 SYNOPSIS use Mojo::Base -strict; use Mojo::IOLoop; use Mojo::FriendFeed; use Data::Dumper; my $ff = Mojo::FriendFeed->new( request => '/feed/cpan' ); $ff->on( entry => sub { say Dumper $_[1] } ); $ff->listen; Mojo::IOLoop->start; =head1 DESCRIPTION A simple non-blocking FriendFeed listener for use with the Mojolicious toolkit. Its code is highly influenced by Miyagawa's L. =head1 EVENTS Mojo::FriendFeed inherits all events from L and implements the following new ones. =head2 entry $ff->on( entry => sub { my ($ff, $entry) = @_; ... }); Emitted when a new entry has been received, once for each entry. It is passed the instance and the data decoded from the JSON response. =head2 error $ff->on( error => sub { my ($ff, $error, $status, $ff_error) = @_; ... }); Emitted for transaction errors. Fatal if not handled. It is passed the instance, the HTTP error message, HTTP status, and the "errorCode" sent from FriendFeed if available. Note that after emitting the error event, the C method exits, though you may use this hook to re-attach if desired. $ff->on( error => sub { shift->listen } ); =head1 ATTRIBUTES Mojo::FriendFeed inherits all attributes from L and implements the following new ones. =head2 request The feed to request. Default is an empty string. =head2 ua An instance of L for making the feed request. =head2 url The (generated) url of the feed. Using the default value is recommended. =head2 username Your FriendFeed username. If set, authentication will be used. =head2 remote_key Your FriendFeed API key. Unused unless C is set. =head1 METHODS Mojo::FriendFeed inherits all methods from L and implements the following new ones. =head2 listen Connects to the feed and attaches events. Note that this does not start an IOLoop and will not block. =head1 SEE ALSO =over =item * L - High performance non-blocking web framework and toolkit for Perl =item * L - IRC interaction for use with the Mojolicious' L =item * L - The inspiration for this module, useful when using L =back =head1 SOURCE REPOSITORY L =head1 AUTHOR Joel Berger, Ejoel.a.berger@gmail.comE =head1 COPYRIGHT AND LICENSE Copyright (C) 2014 by Joel Berger This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.