Creating RSS 2.0 Feeds - guid, Permalink or not
(Page 2 of 4 )
XML::RSS does support the two guid isPermalink options but in a slightly less predictable way than the other element functions. To set guid isPermalink="true", you should do this:
$rss->add_item(
title => "Example Entry 1",
link => http://www.oreilly.com/example/entry1,
description => 'blah blah',
permaLink => http://www.oreilly.com/example/entry1,
);
However, to set guid isPermalink="false", you should do this:
$rss->add_item(
title => "Example Entry 1",
link => http://www.oreilly.com/example/entry1,
description => 'blah blah',
guid => http://www.example.com/guidsRus/348324327,
);
Module support under XML::RSS
As you can see, XML::RSS always includes the namespace declaration for the blogChannel module. You can also use it to include other modules within your feed.
In Example 4-4, we passed known strings to the module. It's really not of much use as a script; you need to add a more dynamic form of data, or the feed will be very boring indeed. We do an awful lot of this sort of thing in Chapter 10, so let's leave Perl until then, and move on to another language.
Next: Creating RSS 2.0 with PHP >>
More XML Tutorials Articles
More By O'Reilly Media
|
This article is excerpted from chapter four of the book Developing Feeds with RSS and Atom, written by Ben Hammersley (O'Reilly; ISBN: 0596008813). Check it out today at your favorite bookstore. Buy this book now.
|
|