NAME

AnyEvent::Superfeedr - XMPP interface to Superfeedr service.

SYNOPSIS

  use AnyEvent::Superfeedr;

  my $callback = sub {
      my AnyEvent::Superfeedr::Notification $notification = shift;
      my $feed_uri    = $notification->feed_uri;
      my $http_status = $notification->http_status;
      my $next_fetch  = $notification->next_fetch;
      printf "status %s for %s. next: %s\n",
              $http_status, $feed_uri, $next_fetch;
      for my XML::Atom::Entry $entry ($notification->entries) {
          printf "Got: %s\n" $entry->title;
      }
  };

  my $superfeedr = AnyEvent::Superfeedr->new(
      jid => $jid,
      password => $password
      on_notification => $callback,
  );
  $superfeedr->connect;
  AnyEvent->condvar->recv;

  # Subsribe upon connection
  my $superfeedr = AnyEvent::Superfeedr->new(
      jid => $jid,
      password => $password,
  );
  $superfeedr->connect(sub { $superfeedr->subscribe($feed_uri) });

  # Periodically fetch new URLs from database and subscribe
  my $timer = AnyEvent->timer(
      after => 5,
      interval => 5 * 60,
      cb => sub {
          my @new_feeds = get_new_feeds_from_database() or return;
          $superfeedr->subscribe(@new_feeds);
      },
  );

  $end->recv;

DESCRIPTION

WARNING: the interface is likely to change in the future.

Allows you to subscribe to feeds and get notified real-time about new content.

This is a first version of the api, and probably only covers specific architectural needs.

EXAMPLES

see in the eg/ directory of the distribution.

AUTHOR

Yann Kerherve <yannk@cpan.org>

CONTRIBUTORS

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

LICENSE

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

SEE ALSO

AnyEvent::XMPP AnyEvent http://superfeedr.com