NAME

AnyEvent::Atom::Stream - XML::Atom::Stream with AnyEvent

SYNOPSIS

use AnyEvent::Atom::Stream;

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

# API is compatible to XML::Atom::Stream
my $client = AnyEvent::Atom::Stream->new(
    callback  => \&callback,
    timeout   => 30,
    on_disconnect => $cv,
);
my $guard = $client->connect($url);

$cv->recv;

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

DESCRIPTION

AnyEvent::Atom::Stream is an XML::Atom::Stream subclass that uses AnyEvent::HTTP and thus allows you to run the stream listener using any of AnyEvent event loop implementation.

METHODS

new
$client = AnyEvent::Atom::Stream->new(
    callback => \&callback,
    timeout  => 30,
    on_disconnect => $cv,
);

Creates a new AnyEvent::Atom::Stream instance. The API is compatible to XML::Atom::Stream, but it doesn't support reconnect parameter, because that's something you can easily control with the new on_disconnect AnyEvent callback.

connect
$guard = $client->connect($url);

Connects and receives Atom update stream.

AUTHOR

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

XML::Atom::Stream, AnyEvent::HTTP, http://updates.sixapart.com/