Perlanet

Name

perlanet - command line interface to Perlanet.pm

Synopsis

$ perlanet

Or

$ perlanet config_file

Description

perlanet is a command line program for aggregating web feeds (both Atom and RSS) and publishing a new web page and a new web feed containing the results of that aggregation.

Command line arguments

perlanet takes one optional command line argument, which is the name of a configuration file to use. If no filename is given then the program looks for a file called perlanetrc in the current directory.

Configuration file

perlanet requires a configuration file which contains details of which feeds to aggregate and what to do with the results of the aggregation. By default, perlanet looks for a file called perlanetrc in the current directory, but this name can be overridden by passing the name of a different file when calling the program.

The configuration file is in YAML format. YAML is a simple text-based file format. See http://yaml.org/ for further details.

Configuration options

The configuration file can contain the following options.

Example configuration file

title: planet test
description: A Test Planet
url: http://planet.example.com/
author:
  name: Dave Cross
  email: dave@dave.org.uk
entries: 20
opml: opml.xml
page:
  file: index.html
  template: index.tt
feed:
  file: atom.xml
  format: Atom
cache_dir: /tmp/feeds
feeds:
  - url: http://blog.dave.org.uk/atom.xml
    title: Dave's Blog
    web: http://blog.dave.org.uk/
  - url: http://use.perl.org/~davorg/journal/rss
    title: Dave's use.perl Journal
    web: http://use.perl.org/~davorg/journal/
  - url: http://www.oreillynet.com/pub/feed/31?au=2607
    title: Dave on O'Reillynet
    web: http://www.oreillynet.com/pub/au/2607

Output template

The web page is created from a Template Toolkit template. This template is passed two variables.

Example output template

This is a simple template which uses the feed variable to display details of the aggregated feeds.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>[% feed.title %]</title>
  </head>
  <body>
    <h1>[% feed.title | html %]</h1>
    <p>[% feed.description | html %]</p>
[% FOREACH entry IN feed.entries %]
    <h2><a href="[% entry.link | url | html %]">[% entry.title | html %]</h2></a>
    [% entry.content.body %]
[% IF entry.author OR entry.issued %]
    <p>Published[% IF entry.author %] by [% entry.author | html; END %]
    [% IF entry.issued %] on [% entry.issued | html; END %]</p>
[% END %]
[% END %]
    <hr />
    <address>[% feed.author | html %] / [% feed.modified | html %]</address>
  </body>
</html>

In the future, the Perlanet wiki at https://github.com/davorg-cpan/perlanet/wiki will contain a cookbook of useful ideas to include in the output template.

Support

To report bugs in Perlanet, please use its issue tracker. You can find it at:

See also

Author

Dave Cross,

Copyright (C) 2008-2018 by Magnum Solutions Ltd.

This program library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.