XML::Atom::Stream(3)

NAME
XML::Atom::Stream - A client interface for AtomStream

SYNOPSIS
  use XML::Atom::Stream;

  my $url = "http://updates.sixapart.com/atom-stream.xml";

  my $client = XML::Atom::Stream->new(
      callback  => \&callback,
      reconnect => 1,
      debug     => 1,
      timeout   => 30,
  );
  $client->connect($url);

  sub callback {
      my($atom) = @_;
      # $atom is a XML::Atom::Feed object
  }

DESCRIPTION
XML::Atom::Stream is a consumer of AtomStream. It connects to Atom stream, the never ending Atom feed and parses the feed by SAX pull parser. Whenever it retrieves a new feed, your callback function will be invoked.

METHODS

new
      my $client = XML::Atom::Stream->new(
          callback  => \&callback,
          reconnect => 1,
          debug     => 1,
      );

    Creates a new XML::Atom::Stream instance.

    callback
        Callback reference to handle new Atom feed. Callback function will receive only one parameter, XML::Atom::Feed object. You can abort the connection by throwing an exception (die) inside the callback.

    reconnect
        Whether to do automatic reconnection when the SAX parser fails to parse the stream data, or the connection gets disconnected. Note that if you abort the connection by dying inside the callback, it won't reconnect. Defaults to 0.

    timeout
        timeout variable which is passed to LWP::UserAgent. Defaults to 15.

    ua  an object of LWP::UserAgent or its subclass to use to connect to the Atom stream. Optional and by default it tries to create its own LWP::UserAgent object.

    debug
        Whether to display debug messages. Defaults to 0.

connect
      $client->connect($url);

    Connects to the Atom stream URL and waits for the incoming feeds.

AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net> with tips from Benjamin Trott and Brad Fitzpatrick.

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

SEE ALSO
XML::Atom, XML::Atom::Filter, http://www.livejournal.com/users/brad/2143713.html