1Wiki::Toolkit::Feed::RSUSs(e3r)Contributed Perl DocumentWaitkiio:n:Toolkit::Feed::RSS(3)
2
3
4
6 Wiki::Toolkit::Feed::RSS - Output RecentChanges RSS for Wiki::Toolkit.
7
9 This is an alternative access to the recent changes of a Wiki::Toolkit
10 wiki. It outputs RSS as described by the ModWiki proposal at
11 <http://www.usemod.com/cgi-bin/mb.pl?ModWiki>
12
14 use Wiki::Toolkit;
15 use Wiki::Toolkit::Feed::RSS;
16
17 my $wiki = CGI::Wiki->new( ... ); # See perldoc Wiki::Toolkit
18
19 # Set up the RSS feeder with the mandatory arguments - see
20 # C<new()> below for more, optional, arguments.
21 my $rss = Wiki::Toolkit::Feed::RSS->new(
22 wiki => $wiki,
23 site_name => 'My Wiki',
24 site_url => 'http://example.com/',
25 make_node_url => sub
26 {
27 my ($node_name, $version) = @_;
28 return 'http://example.com/?id=' . uri_escape($node_name) . ';version=' . uri_escape($version);
29 },
30 html_equiv_link => 'http://example.com/?RecentChanges',
31 encoding => 'UTF-8'
32 );
33
34 print "Content-type: application/xml\n\n";
35 print $rss->recent_changes;
36
38 "new()"
39 my $rss = Wiki::Toolkit::Feed::RSS->new(
40 # Mandatory arguments:
41 wiki => $wiki,
42 site_name => 'My Wiki',
43 site_url => 'http://example.com/',
44 make_node_url => sub
45 {
46 my ($node_name, $version) = @_;
47 return 'http://example.com/?id=' . uri_escape($node_name) . ';version=' . uri_escape($version);
48 },
49 html_equiv_link => 'http://example.com/?RecentChanges',
50
51 # Optional arguments:
52 site_description => 'My wiki about my stuff',
53 interwiki_identifier => 'MyWiki',
54 make_diff_url => sub
55 {
56 my $node_name = shift;
57 return 'http://example.com/?diff=' . uri_escape($node_name)
58 },
59 make_history_url => sub
60 {
61 my $node_name = shift;
62 return 'http://example.com/?hist=' . uri_escape($node_name)
63 },
64 software_name => $your_software_name, # e.g. "CGI::Wiki"
65 software_version => $your_software_version, # e.g. "0.73"
66 software_homepage => $your_software_homepage, # e.g. "http://search.cpan.org/dist/Wiki-Toolkit/"
67 );
68
69 "wiki" must be a Wiki::Toolkit object. "make_node_url", and
70 "make_diff_url" and "make_history_url", if supplied, must be coderefs.
71
72 The mandatory arguments are:
73
74 · wiki
75
76 · site_name
77
78 · site_url
79
80 · make_node_url
81
82 · html_equiv_link or recent_changes_link
83
84 The three optional arguments
85
86 · software_name
87
88 · software_version
89
90 · software_homepage
91
92 are used to generate DOAP (Description Of A Project - see
93 <http://usefulinc.com/doap>) metadata for the feed to show what
94 generated it.
95
96 The optional argument
97
98 · encoding
99
100 will be used to specify the character encoding in the feed. If not set,
101 will default to the wiki store's encoding.
102
103 "recent_changes()"
104 $wiki->write_node(
105 'About This Wiki',
106 'blah blah blah',
107 $checksum,
108 {
109 comment => 'Stub page, please update!',
110 username => 'Fred',
111 }
112 );
113
114 print "Content-type: application/xml\n\n";
115 print $rss->recent_changes;
116
117 # Or get something other than the default of the latest 15 changes.
118 print $rss->recent_changes( items => 50 );
119 print $rss->recent_changes( days => 7 );
120
121 # Or ignore minor edits.
122 print $rss->recent_changes( ignore_minor_edits => 1 );
123
124 # Personalise your feed further - consider only changes
125 # made by Fred to pages about bookshops.
126 print $rss->recent_changes(
127 filter_on_metadata => {
128 username => 'Fred',
129 category => 'Bookshops',
130 },
131 );
132
133 If using "filter_on_metadata", note that only changes satisfying all
134 criteria will be returned.
135
136 Note: Many of the fields emitted by the RSS generator are taken from
137 the node metadata. The form of this metadata is not mandated by
138 Wiki::Toolkit. Your wiki application should make sure to store some or
139 all of the following metadata when calling "write_node":
140
141 comment - a brief comment summarising the edit that has just been made;
142 will be used in the RDF description for this item. Defaults to the
143 empty string.
144 username - an identifier for the person who made the edit; will be used
145 as the Dublin Core contributor for this item, and also in the RDF
146 description. Defaults to the empty string.
147 host - the hostname or IP address of the computer used to make the
148 edit; if no username is supplied then this will be used as the Dublin
149 Core contributor for this item. Defaults to the empty string.
150 major_change - true if the edit was a major edit and false if it was a
151 minor edit; used for the importance of the item. Defaults to true (ie
152 if "major_change" was not defined or was explicitly stored as "undef").
153
154 "feed_timestamp()"
155 print $rss->feed_timestamp();
156
157 Returns the timestamp of the feed in POSIX::strftime style ("Tue, 29
158 Feb 2000 12:34:56 GMT"), which is equivalent to the timestamp of the
159 most recent item in the feed. Takes the same arguments as
160 recent_changes(). You will most likely need this to print a Last-
161 Modified HTTP header so user-agents can determine whether they need to
162 reload the feed or not.
163
164 "generate_node_list_feed"
165 Generate and return an RSS feed for a list of nodes
166
167 "generate_node_name_distance_feed"
168 Generate a very cut down rss feed, based just on the nodes, their
169 locations (if given), and their distance from a reference location (if
170 given).
171
172 Typically used on search feeds.
173
174 "feed_timestamp"
175 Generate the timestamp for the RSS, based on the newest node (if
176 available). Will return a timestamp for now if no node dates are
177 available
178
179 "parse_feed_timestamp"
180 Take a feed_timestamp and return a Time::Piece object.
181
183 · Wiki::Toolkit
184
185 · <http://web.resource.org/rss/1.0/spec>
186
187 · <http://www.usemod.com/cgi-bin/mb.pl?ModWiki>
188
190 The Wiki::Toolkit project. Originally by Kake Pugh <kake@earth.li>.
191
193 Copyright 2003-4 Kake Pugh. Copyright 2005 Earle Martin. Copyright
194 2006-2009 the Wiki::Toolkit team
195
196 This module is free software; you can redistribute it and/or modify it
197 under the same terms as Perl itself.
198
200 The members of the Semantic Web Interest Group channel on
201 irc.freenode.net, #swig, were very useful in the development of this
202 module.
203
204
205
206perl v5.30.0 2019-07-26 Wiki::Toolkit::Feed::RSS(3)