The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


Template::Plugin::XML::Feed - Plugin interface to XML::Feed


    [% USE news = XML.Feed('news.rdf') %]
    [% FOREACH item IN news.items %]
       [% item.title %]
       [%  %]
    [% END %]


This Template Toolkit plugin provides a simple interface to the XML::Feed module.

    [% USE news = XML.Feed('mysite.rdf') %]

It creates an XML::Feed object, which is then used to parse the RSS or Atom file specified as a parameter in the USE directive. A reference to the XML::Feed object is then returned.

The attributes of the channel and image elements can be retrieved directly from the plugin object using the familiar dotted compound notation:

    [%  %]
    [%   %]
    [% %]  

    [% news.image.title    %]
    [% news.image.url      %]
    [%     %]
    [% news.image.etc...   %]  

The list of news items can be retrieved using the 'items' method:

    [% FOREACH item IN news.items %]
       [% item.title %]
       [%  %]
    [% END %]



Constructor method. Delegates to XML::Feed->parse to create an XML::Feed object. Not usually called directly.


This plugin was written by Dave Cross and was heavily based on the code for Template::Plugin::XML::RSS by Andy Wardley.

The XML::Feed module, which implements all of the functionality that this plugin delegates to, was written by Benjamin Trott and is now maintained by Dave Cross.


Copyright (C) 2009-2020 Magnum Solutions Ltd. All Rights Reserved.

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


Template::Plugin, XML::Feed