View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Ian Kluft > WebFetch > WebFetch::Input::SiteNews



Annotate this POD


New  1
Open  0
View/Report Bugs


WebFetch::Input::SiteNews - download and save SiteNews headlines


In perl scripts:

use WebFetch::Input::SiteNews;

From the command line:

perl -w -MWebFetch::Input::SiteNews -e "&fetch_main" -- --dir directory --source news-file --short short-form-output-file --long long-form-output-file


This module gets the current headlines from a site-local file.

The --source parameter specifies a file name which contains news to be posted. See "FILE FORMAT" below for details on contents to put in the file. --source may be specified more than once, allowing a single news output to come from more than one input. For example, one file could be manually maintained in CVS or RCS and another could be entered from a web form.

After this runs, the file site_news.html will be created or replaced. If there already was a site_news.html file, it will be moved to Osite_news.html.


The WebFetch::Input::SiteNews data format is used to set up news for the local web site and allow other sites to import it via WebFetch. The file is plain text containing comments and the news items.

There are three forms of outputs generated from these news files.

The "short news" output is a small number (5 by default) of HTML text and links used for display in a small news window. This list takes into account expiration dates and priorities to pick which news entries are displayed and in what order.

The "long news" output lists all the news entries chronologically. It does not take expiration or priority into account. It is intended for a comprehensive site news list.

The export modes make news items available in formats other web sites can retrieve to post news about your site. They are chronological listings that omit expired items. They do not take priorities into account.

global parameters

Lines coming before the first news item can set global parameters.


A line before the first news item beginning with "categories:" contains a whitespace-delimited list of news category names in order from highest to lowest priority. These priority names are used by the news item attributes and then for sorting "short news" list items.

data lines

Non-blank non-indented non-comment lines are data lines. Each data line contains a name=value pair. Each group of consecutive data lines is followed by an arbitrary number of indented lines which contain HTML text for the news entry.

The recognized attributes are as follows:


used for prioritization, values are set by the categories global parameter (required)


date posted, format is a numerical date YYYYMMDD (required)


expiration date, format is a numerical date YYYYMMDD (optional)


shorter title for use in news exports to other sites, otherwise the whole news text will be used (optional)

text lines

Intended lines are HTML text for the news item.


Comments are lines beginning with "#". They are ignored so they can be used for human-readable information.

Note that the "short news" list has some modifications to priorities based on the age of the news item, so that the short list will favor newer items when they're the same priority. There is a sorting "priority bonus" for items less than a day old, which increases their priority by two priority levels. Day-old news items get a bonus of one priority level. All news items also "decay" in priority slightly every day, dropping a whole priority level every 40 days.


WebFetch was written by Ian Kluft Send patches, bug reports, suggestions and questions to


syntax highlighting: