www.slrn.org / slrn.sourceforge.net
home of the slrn newsreader
Cleanscore
Sun Feb 3 22:25:49 CET 2002
Information

If you heavily use slrn's scoring capabilities, your scorefile will soon become large and confusing, so you will want to remove expired entries on a regular basis. This perl script can be used to purge expired entries automatically, e.g. by calling it from cron.daily.

Features
Date formats
Cleanscore handles both date formats (DD-MM-YYYY and MM/DD/YYYY) correctly.
Comments
Cleanscore ignores "Expires:" lines when they are commented out (both '%' and '#' are recognized), but it removes comments that belong to expired entries.
groupexp
Cleanscore checks whether the groupexp ([group.name]) is still needed and keeps it if necessary.
Protecting handwritten comments
Because of the loose syntax of slrn's scorefiles, cleanscore cannot be sure to which entry a comment line between two entries belongs. By default, cleanscore deletes all comments before an expired entry when purging and leaves comments after it untouched. In most cases, this is fine.
If you do not want cleanscore to remove a comment that will be deleted according to the above rule (e.g. because you added it by hand to structure your scorefile), you may use special comments to tell cleanscore where an entry starts and / or where it stops:
  • "%BOS" or "#BOS" tell cleanscore that a new entry starts here.
  • "%EOS" or "#EOS" tell cleanscore that the current entry stops right here.
If an entry marked like this is expired, the marks are removed along with it.
Keep expired entries longer
With the command line option '-k n' you can tell cleanscore to purge entries only when they expired at least n days ago. This way, if you realize within n days that you want an expired entry to become active again, you can simply set a new date of expiry instead of having to type it in again.
Clean a directory
If the given filename is a directory cleanscore handels it as a directory full of scorefiles. Nice if you've you scorefile splited up into small, handy files.
Save all expired entries into one file
If you don't want to lose expired entries forever, you can use the command line option '-s savefile' to say cleanscore where to save these entrys.
Cut multiple empty lines down
Because slrns scorefile-syntax is not designed for automated-cleaning, it is not easy to decide witch commend or emptyline belongs to witch entry. The most times the "BOS"/"EOS" feature helps, but in some cases empty lines are not removed. So you'll got blocks with many empty lines. Running cleanscore with the '-e n' command line option cut these blocks down to nempty lines each.
Test-only mode
If you don't trust this script or if you think there's a bug in it, you can test it in detail without risking your scorefile. (In normal mode a backup copy named $SCOREFILE.bak is kept of course.)
 

Download
 
You can get the latest version as a tar.gz archive here.
 

Changes
0.9.8.0 -> 0.9.8.1
  • Complete code-cleanup (e.g. setting 'use strict').
  • the '-e' option now works better, but a little slower.
  • New, improved README.
  • New file INDEX.TXT
Released on 2002-04-09
0.9.7.4 -> 0.9.8.0
  • Added an option to cut multiple empty lines down. (suggested by Guido Ostkamp)
  • Cleanscore now can clean all files in a directory.
  • The extention for the backupfiles is now configurable.
  • The original file is only copyed to a backupfile if there's really a change.
  • Moved changes from README to changes.txt.
Released on 2001-09-14
0.9.7.3 -> 0.9.7.4
Added savefile option. (suggested by Sven Guckes)
Released on 2001-08-12
0.9.7.2 -> 0.9.7.3
  • Cleanscore now uses "flock" to lock the scorefile. (suggested by "The Joneses")
  • Some cleanup in the code.
Released on 2001-02-17
0.9.7.1 -> 0.9.7.2
Small bugfix: Newer versions of perl want an explizit declaration of each function.
Released on 2001-01-05
0.9.7 -> 0.9.7.1
Small bugfix: Cleanscore now uses your local time to calculate if a score is expired and not GMT as before.
Released on 2000-11-30
0.9.6 -> 0.9.7
  • The 'debug' mode now gives output in a useful form.
  • Cleanscore can work test-only now.
Released on 2000-11-26
0.9.5.1 -> 0.9.6
Inserted Copyright notice and changed distribution format.
Released on 2000-03-19

This page
Site map
Latest changes
[2002-04-09]
Released version 0.9.8.1.
[2001-09-14]
Released version 0.9.8.0.
[2001-08-12]
Released version 0.9.7.4.
[2001-02-17]
Released version 0.9.7.3.
[2001-01-05]
Released version 0.9.7.2.
[2000-11-30]
Released version 0.9.7.1.
[2000-11-26]
Released version 0.9.7.
[2000-07-07]
Moved the page to SourceForge.
[2000-03-19]
Completely rewrote the webpage and changed distribution format.
Hosting
SourceForge Logo
This project is kindly hosted by SourceForge.
HTML validation
Valid HTML 4.0!
This webpage complies with the W3C HTML standards.
Cleanscore is written by Felix Schueller. This page is designed by Thomas Schultz. © 2000