++ed by:
BEROV

1 PAUSE user

Author image Dotan Dimet דותן דימט
and 3 contributors

NAME

Mojo::Feed::Item - represents an item from an RSS/Atom feed.

SYNOPSIS

    use Mojo::Feed;

    my $feed = Mojo::Feed->new("atom.xml");

    my $item = $feed->items->first;

    print $item->title, $item->author, $item->published, "\n";

DESCRIPTION

Mojo::Feed::Item is an Object wrapper for a item from an RSS or Atom Feed.

ATTRIBUTES

Mojo::Feed::Item implements the following attributes.

title

content

May be filled with content:encoded, xhtml:body or description fields

id

Will be equal to link or guid if it is undefined and either of those fields exists

description

Optional - usually a shorter form of the content (may be filled with summary if description is missing)

guid

Optional

published

Time in epoch seconds (may be filled with pubDate, dc:date, created, issued, updated or modified)

author

May be filled from author or dc:creator

tags

Optional - array ref of tags, categories or dc:subjects.

enclosures

Optional - array ref of enclosures, each a hashref with the keys url, type and length.

feed

A reference to the feed this item belongs to. Note that this is a weak reference, so it maybe undefined, if the parent feed is no longer in scope.

METHODS

Mojo::Feed::Item inherits all methods from Mojo::Base and adds the following ones:

to_hash

  my $hash = $item->to_hash;
  print $hash->{title};

Return a hash reference representing the item.

to_string

Return a XML serialized text of the item's Mojo::DOM node. Note that this can be different from the original XML text in the feed.

CREDITS

Dotan Dimet

Mario Domgoergen

Some tests adapted from Feed::Find and XML:Feed, Feed auto-discovery adapted from Feed::Find.

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018-2019 by Dotan Dimet <dotan@corky.net>.

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

Test data (web pages, feeds and excerpts) included in this package is intended for testing purposes only, and is not meant in any way to infringe on the rights of the respective authors.

AUTHOR

Dotan Dimet <dotan@corky.net>