Wiki::...d::Atom(3pm)

πŸ“¦
version 0.86 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Wiki::Toolkit::Feed::Atom β€” the manual, but make it cute ✨

okay bestie, so this is the page for Wiki::Toolkit::Feed::Atom(3pm) β€” a Perl module from the Wiki::Toolkit team, and honestly? it's giving "let my wiki have a feed" energy πŸŽ€


🌸 NAME 🌸

Wiki::Toolkit::Feed::Atom β€” literally a Wiki::Toolkit plugin that outputs RecentChanges in Atom. that's the whole job. she does it well. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this is an alternative way to get at the recent changes of a Wiki::Toolkit wiki. instead of RSS, she hands you the Atom Syndication Format, as described over at <http://www.atomenabled.org/developers/syndication/> ✨

and here's the tea: this module is a straight port of Wiki::Toolkit::Feed::RSS. like, same girl, different syndication format. no cap. πŸ”₯


⭐ SYNOPSIS ⭐

here's the vibe, in code, exactly as written:

use Wiki::Toolkit;
use Wiki::Toolkit::Feed::Atom;

my $wiki = Wiki::Toolkit->new( ... );  # See perldoc Wiki::Toolkit

# Set up the RSS feeder with the mandatory arguments - see
# C<new()> below for more, optional, arguments.
my $atom = Wiki::Toolkit::Feed::Atom->new(
  wiki                => $wiki,
  site_name           => 'My Wiki',
  site_url            => 'http://example.com/',
  make_node_url       => sub
                         {
                           my ($node_name, $version) = @_;
                           return 'http://example.com/?id=' . uri_escape($node_name) . ';version=' . uri_escape($version);
                         },
  html_equiv_link => 'http://example.com/?RecentChanges',
  atom_link => 'http://example.com/?action=rc;format=atom',
);

print "Content-type: application/atom+xml\n\n";
print $atom->recent_changes;

yes, that comment does say "RSS feeder" β€” we're keeping it real, that's what the original says 🫢


πŸ’œ METHODS πŸ’œ

πŸŽ€ "new()" πŸŽ€

constructor time, bestie. look at her:

my $atom = Wiki::Toolkit::Feed::Atom->new(
  # Mandatory arguments:
  wiki                 => $wiki,
  site_name            => 'My Wiki',
  site_url             => 'http://example.com/',
  make_node_url        => sub
                          {
                            my ($node_name, $version) = @_;
                            return 'http://example.com/?id=' . uri_escape($node_name) . ';version=' . uri_escape($version);
                          },
  html_equiv_link  => 'http://example.com/?RecentChanges',,
  atom_link => 'http://example.com/?action=rc;format=atom',

  # Optional arguments:
  site_description     => 'My wiki about my stuff',
  software_name        => $your_software_name,     # e.g. "Wiki::Toolkit"
  software_version     => $your_software_version,  # e.g. "0.73"
  software_homepage    => $your_software_homepage, # e.g. "http://search.cpan.org/dist/CGI-Wiki/"
  encoding             => 'UTF-8'
);

(that double comma after 'http://example.com/?RecentChanges' is canon, don't @ me πŸ’€)

rules of the game, okay:

  • "wiki" must be a Wiki::Toolkit object. non-negotiable.
  • "make_node_url", if you supply it, must be a coderef.

the mandatory arguments are: πŸ‘‘

  • wiki
  • site_name
  • site_url
  • make_node_url
  • html_equiv_link or recent_changes_link
  • atom_link

the three optional arguments 🌸

  • software_name
  • software_version
  • software_homepage

are used to generate the "generator" part of the feed. cute, right?

the optional argument ✨

  • encoding

will be used to specify the character encoding in the feed. and if you don't set it? it defaults to the wiki store's encoding. she's got a fallback, she's prepared. πŸŽ€


πŸ“ "recent_changes()" πŸ“

the main character method, honestly. here she is in action:

$wiki->write_node(
                   'About This Wiki',
                   'blah blah blah',
                       $checksum,
                       {
                         comment  => 'Stub page, please update!',
                         username => 'Fred',
                       }
);

print "Content-type: application/atom+xml\n\n";
print $atom->recent_changes;

# Or get something other than the default of the latest 15 changes.
print $atom->recent_changes( items => 50 );
print $atom->recent_changes( days => 7 );

# Or ignore minor edits.
print $atom->recent_changes( ignore_minor_edits => 1 );

# Personalise your feed further - consider only changes
# made by Fred to pages about bookshops.
print $atom->recent_changes(
           filter_on_metadata => {
                       username => 'Fred',
                       category => 'Bookshops',
                     },
            );

if you're using "filter_on_metadata", heads up: only changes satisfying all criteria will be returned. all of them. no partial matches, she's strict like that 🧚

Note: Many of the fields emitted by the Atom generator are taken from the node metadata. The form of this metadata is not mandated by Wiki::Toolkit. Your wiki application should make sure to store some or all of the following metadata when calling "write_node":

here's the metadata lowdown, bestie πŸ‘‡

  • comment β€” a brief comment summarising the edit that has just been made; will be used in the summary for this item. Defaults to the empty string.
  • username β€” an identifier for the person who made the edit; will be used as the Dublin Core contributor for this item, and also in the RDF description. Defaults to 'No description given for change'.
  • host β€” the hostname or IP address of the computer used to make the edit; if no username is supplied then this will be used as the author for this item. Defaults to 'Anonymous'.

πŸ¦„ "generate_node_list_feed" πŸ¦„

generate and return an Atom feed for a list of nodes. that's it, that's the whole deal. iconic behavior. ✨


🌈 "generate_node_name_distance_feed" 🌈

generates a very cut down atom feed β€” based just on the nodes, their locations (if given), and their distance from a reference location (if given). lowkey minimal, highkey useful. πŸ’«

typically used on search feeds, iykyk.


πŸ‘‘ "feed_timestamp()" πŸ‘‘

print $atom->feed_timestamp();

returns the timestamp of the feed in POSIX::strftime style ("Tue, 29 Feb 2000 12:34:56 GMT"), which is equivalent to the timestamp of the most recent item in the feed. takes the same arguments as recent_changes().

and like β€” you will most likely need this to print a Last-Modified HTTP header so user-agents can determine whether they need to reload the feed or not. so yeah, she matters. 🫢


🌸 "parse_feed_timestamp" 🌸

takes a feed_timestamp and returns a Time::Piece object. that's the whole thing. short and slay. πŸ’…


πŸŽ€ SEE ALSO πŸŽ€


πŸ’– MAINTAINER πŸ’–

The Wiki::Toolkit team, http://www.wiki-toolkit.org/. they're the parents, they're keeping her fed and watered 🫢


Copyright 2006-2009 Earle Martin and the Wiki::Toolkit team. Copyright 2012 the Wiki::Toolkit team.

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


πŸ¦‹ THANKS πŸ¦‹

Kake Pugh for originally writing Wiki::Toolkit::Feed::RSS and indeed Wiki::Toolkit itself. absolute legend behaviour, we stan. πŸ‘‘


and that's the page, bestie! ✨ this one's perl v5.32.0, dated 2021-01-04, from the docs that ship with Wiki::Toolkit::Feed::Atom β€” go forth and syndicate your recent changes responsibly πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from