1Wiki::Toolkit::Feed::AtUosme(r3)Contributed Perl DocumenWtiaktii:o:nToolkit::Feed::Atom(3)
2
3
4
6 Wiki::Toolkit::Feed::Atom - A Wiki::Toolkit plugin to output RecentChanges Atom.
7
9 This is an alternative access to the recent changes of a Wiki::Toolkit
10 wiki. It outputs the Atom Syndication Format as described at
11 <http://www.atomenabled.org/developers/syndication/>.
12
13 This module is a straight port of Wiki::Toolkit::Feed::RSS.
14
16 use Wiki::Toolkit;
17 use Wiki::Toolkit::Feed::Atom;
18
19 my $wiki = Wiki::Toolkit->new( ... ); # See perldoc Wiki::Toolkit
20
21 # Set up the RSS feeder with the mandatory arguments - see
22 # C<new()> below for more, optional, arguments.
23 my $atom = Wiki::Toolkit::Feed::Atom->new(
24 wiki => $wiki,
25 site_name => 'My Wiki',
26 site_url => 'http://example.com/',
27 make_node_url => sub
28 {
29 my ($node_name, $version) = @_;
30 return 'http://example.com/?id=' . uri_escape($node_name) . ';version=' . uri_escape($version);
31 },
32 html_equiv_link => 'http://example.com/?RecentChanges',
33 atom_link => 'http://example.com/?action=rc;format=atom',
34 );
35
36 print "Content-type: application/atom+xml\n\n";
37 print $atom->recent_changes;
38
40 "new()"
41 my $atom = Wiki::Toolkit::Feed::Atom->new(
42 # Mandatory arguments:
43 wiki => $wiki,
44 site_name => 'My Wiki',
45 site_url => 'http://example.com/',
46 make_node_url => sub
47 {
48 my ($node_name, $version) = @_;
49 return 'http://example.com/?id=' . uri_escape($node_name) . ';version=' . uri_escape($version);
50 },
51 html_equiv_link => 'http://example.com/?RecentChanges',,
52 atom_link => 'http://example.com/?action=rc;format=atom',
53
54 # Optional arguments:
55 site_description => 'My wiki about my stuff',
56 software_name => $your_software_name, # e.g. "Wiki::Toolkit"
57 software_version => $your_software_version, # e.g. "0.73"
58 software_homepage => $your_software_homepage, # e.g. "http://search.cpan.org/dist/CGI-Wiki/"
59 encoding => 'UTF-8'
60 );
61
62 "wiki" must be a Wiki::Toolkit object. "make_node_url", if supplied,
63 must be a coderef.
64
65 The mandatory arguments are:
66
67 · wiki
68
69 · site_name
70
71 · site_url
72
73 · make_node_url
74
75 · html_equiv_link or recent_changes_link
76
77 · atom_link
78
79 The three optional arguments
80
81 · software_name
82
83 · software_version
84
85 · software_homepage
86
87 are used to generate the "generator" part of the feed.
88
89 The optional argument
90
91 · encoding
92
93 will be used to specify the character encoding in the feed. If not set,
94 will default to the wiki store's encoding.
95
96 "recent_changes()"
97 $wiki->write_node(
98 'About This Wiki',
99 'blah blah blah',
100 $checksum,
101 {
102 comment => 'Stub page, please update!',
103 username => 'Fred',
104 }
105 );
106
107 print "Content-type: application/atom+xml\n\n";
108 print $atom->recent_changes;
109
110 # Or get something other than the default of the latest 15 changes.
111 print $atom->recent_changes( items => 50 );
112 print $atom->recent_changes( days => 7 );
113
114 # Or ignore minor edits.
115 print $atom->recent_changes( ignore_minor_edits => 1 );
116
117 # Personalise your feed further - consider only changes
118 # made by Fred to pages about bookshops.
119 print $atom->recent_changes(
120 filter_on_metadata => {
121 username => 'Fred',
122 category => 'Bookshops',
123 },
124 );
125
126 If using "filter_on_metadata", note that only changes satisfying all
127 criteria will be returned.
128
129 Note: Many of the fields emitted by the Atom generator are taken from
130 the node metadata. The form of this metadata is not mandated by
131 Wiki::Toolkit. Your wiki application should make sure to store some or
132 all of the following metadata when calling "write_node":
133
134 comment - a brief comment summarising the edit that has just been made;
135 will be used in the summary for this item. Defaults to the empty
136 string.
137 username - an identifier for the person who made the edit; will be used
138 as the Dublin Core contributor for this item, and also in the RDF
139 description. Defaults to 'No description given for change'.
140 host - the hostname or IP address of the computer used to make the
141 edit; if no username is supplied then this will be used as the author
142 for this item. Defaults to 'Anonymous'.
143
144 "generate_node_list_feed"
145 Generate and return an Atom feed for a list of nodes
146
147 "generate_node_name_distance_feed"
148 Generate a very cut down atom feed, based just on the nodes, their
149 locations (if given), and their distance from a reference location (if
150 given).
151
152 Typically used on search feeds.
153
154 "feed_timestamp()"
155 print $atom->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 "parse_feed_timestamp"
165 Take a feed_timestamp and return a Time::Piece object.
166
168 · Wiki::Toolkit
169
170 · <http://www.atomenabled.org/developers/syndication/>
171
173 The Wiki::Toolkit team, http://www.wiki-toolkit.org/.
174
176 Copyright 2006-2009 Earle Martin and the Wiki::Toolkit team. Copyright
177 2012 the Wiki::Toolkit team.
178
179 This module is free software; you can redistribute it and/or modify it
180 under the same terms as Perl itself.
181
183 Kake Pugh for originally writing Wiki::Toolkit::Feed::RSS and indeed
184 Wiki::Toolkit itself.
185
186
187
188perl v5.32.0 2020-07-28 Wiki::Toolkit::Feed::Atom(3)