Templa...L::RSS(3pm)
β¨ NAME β¨
Template::Plugin::XML::RSS β it's giving plugin interface to XML::RSS, and ngl it's iconic π
okay so bestie, welcome to Templa...L::RSS(3pm), a page from the User Contributed Perl Documentation. Sit down, grab a strawberry π, we're parsing RSS today.
π SYNOPSIS π
[% USE news = XML.RSS('news.rdf') %]
[% FOREACH item IN news.items %]
[% item.title %]
[% item.link %]
[% END %]
look at that. clean. no notes. π
π¦ DESCRIPTION π¦
So here's the tea β β this Template Toolkit plugin is a simple interface to the XML::RSS module. That's it. That's the whole vibe.
[% USE news = XML.RSS('mysite.rdf') %]
What's happening under the hood: it creates an XML::RSS object, and then that object gets used to parse the RSS file you specified as a parameter in the USE directive. And what comes back to you? A reference to the XML::RSS object. Periodt. π«Ά
Now, an RSS (Rich Site Summary) file is typically used to store short news 'headlines' describing different links within a site. This next example is extracted from http://slashdot.org/slashdot.rdf β shoutout slashdot, the original main character:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://my.netscape.com/rdf/simple/0.9/">
<channel>
<title>Slashdot:News for Nerds. Stuff that Matters.</title>
<link>http://slashdot.org</link>
<description>News for Nerds. Stuff that Matters</description>
</channel>
<image>
<title>Slashdot</title>
<url>http://slashdot.org/images/slashdotlg.gif</url>
<link>http://slashdot.org</link>
</image>
<item>
<title>DVD CCA Battle Continues Next Week</title>
<link>http://slashdot.org/article.pl?sid=00/01/12/2051208</link>
</item>
<item>
<title>Matrox to fund DRI Development</title>
<link>http://slashdot.org/article.pl?sid=00/01/13/0718219</link>
</item>
<item>
<title>Mike Shaver Leaving Netscape</title>
<link>http://slashdot.org/article.pl?sid=00/01/13/0711258</link>
</item>
</rdf:RDF>
The attributes of the channel and image elements? You can grab those directly from the plugin object using the familiar dotted compound notation. iykyk β¨
[% news.channel.title %]
[% news.channel.link %]
[% news.channel.etc... %]
[% news.image.title %]
[% news.image.url %]
[% news.image.link %]
[% news.image.etc... %]
And the list of news items? Retrieved using the 'items' method, bestie:
[% FOREACH item IN news.items %]
[% item.title %]
[% item.link %]
[% END %]
π AUTHORS π
- This plugin was written by Andy Wardley, inspired by an article in Web Techniques by Randal Schwartz. π«Ά
- The
XML::RSSmodule β which implements all of the functionality that this plugin delegates to β was written by Jonathan Eisenzopf. no cap, all the actual work lives over there π§
π COPYRIGHT π
Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay π
πΈ SEE ALSO πΈ
Template::PluginXML::RSSXML::Parser
and that's the whole page, bestie π¦π it's perl v5.34.0, dated 2022-07-04, and it lives in the Templa...L::RSS(3pm) files. go forth and parse some headlines π₯β¨
π¦ where this page comes from
- debian bookworm: libtemplate-plugin-xml-perl 2.17-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtemplate-plugin-xml-perl 2.17-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtemplate-plugin-xml-perl 2.17-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtemplate-plugin-xml-perl 2.17-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtemplate-plugin-xml-perl 2.17-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms