Tatsuhiko Miyagawa > XML-Atom-0.12_01 > XML::Atom::Feed

Download:
XML-Atom-0.12_01.tar.gz

Dependencies

Annotate this POD (1)

CPAN RT

New  21
Open  8
View/Report Bugs
Source   Latest Release: XML-Atom-0.41

NAME ^

XML::Atom::Feed - Atom feed

SYNOPSIS ^

    use XML::Atom::Feed;
    use XML::Atom::Entry;
    my $feed = XML::Atom::Feed->new;
    $feed->title('My Weblog');
    my $entry = XML::Atom::Entry->new;
    $entry->title('First Post');
    $entry->content('Post Body');
    $feed->add_entry($entry);
    my @entries = $feed->entries;
    my $xml = $feed->as_xml;

    ## Get a list of the <link rel="..." /> tags in the feed.
    my $links = $feed->link;

    ## Find all of the Atom feeds on a given page, using auto-discovery.
    my @uris = XML::Atom::Feed->find_feeds('http://www.example.com/');

    ## Use auto-discovery to load the first Atom feed on a given page.
    my $feed = XML::Atom::Feed->new(URI->new('http://www.example.com/'));

USAGE ^

XML::Atom::Feed->new([ $stream ])

Creates a new feed object, and if $stream is supplied, fills it with the data specified by $stream.

Automatically handles autodiscovery if $stream is a URI (see below).

Returns the new XML::Atom::Feed object. On failure, returns undef.

$stream can be any one of the following:

XML::Atom::Feed->find_feeds($uri)

Given a URI $uri, use auto-discovery to find all of the Atom feeds linked from that page (using <link> tags).

Returns a list of feed URIs.

$feed->link

If called in scalar context, returns an XML::Atom::Link object corresponding to the first <link> tag found in the feed.

If called in list context, returns a list of XML::Atom::Link objects corresponding to all of the <link> tags found in the feed.

$feed->add_link($link)

Adds the link $link, which must be an XML::Atom::Link object, to the feed as a new <link> tag. For example:

    my $link = XML::Atom::Link->new;
    $link->type('text/html');
    $link->rel('alternate');
    $link->href('http://www.example.com/');
    $feed->add_link($link);

$feed->language

Returns the language of the feed, from xml:lang.

$feed->author([ $author ])

Returns an XML::Atom::Person object representing the author of the entry, or undef if there is no author information present.

If $author is supplied, it should be an XML::Atom::Person object representing the author. For example:

    my $author = XML::Atom::Person->new;
    $author->name('Foo Bar');
    $author->email('foo@bar.com');
    $feed->author($author);

AUTHOR & COPYRIGHT ^

Please see the XML::Atom manpage for author, copyright, and license information.

syntax highlighting: