www.Michael-Forman.com

Perl Resources


Introduction

This entire website is coded in run-time interpreted perl. Thanks to the wonders of Mason I've been able to finally untie my hands and leave PHP behind. No source for the website has been released, because it's not really a package but rather an ever-changing organic collection of scripts. If there is something that is of special interest, send me an email and I'll give you the code of interest.

Included below are links to my most useful and interesting perl scripts. There are scripts for changing file metadata on the command line, manipulating multimedia files, exploring 3D graphics, and more. The files are listed in order of utility. These scripts will be of most use to those who run Unix, GNU/Linux, or MacOS X and are comfortable using the command line.

I recommend the program "newpl". It's a program that writes an empty perl-file template as an executable file and invokes your favorite editor on it. The template contains command-line parameter parsing, a perldoc skeleton, and some default subroutines. Think of it as "perl script in a can".

Second on the list of useful scripts is "ren-regexp." It allows the renaming of files on the command line using a sequence of perl regular expressions. The command "ren-regexp "s/.AVI/.DivX.avi/" "s/_/ /g" *avi" applies the two regular expressions on all files matching the glob "*avi", renaming them if a regular expression succeeds. This program has proven itself to be indispensable (like tape I don't know how I'd live without it), as it combines the power of the command-line interface and perl regular expressions. I have this program aliased to "ren".

The final must-have program is "ren-backup". This program backs up files (by copy or move) using an RFC-822-compliant date suffix. This is useful on systems, where multiple system administrators (or a single sloppy system administrator) have a habit of backing up configuration files with characters such as "~", "-", or even the dreaded ".bak". The backed-up file takes on the form "filename-YYYY-MM-DD". If that file exists, it takes the form "filename-YYYY-MM-DD-HH:MM:SS".

newpl>>  Click to open

Name newpl
Version 1.15
Updated 2004/03/16 21:09:58
RCS newpl,v 1.15 2004/03/16 21:09:58 forman Exp forman
Rating star star star star star
Category Perl
Description newpl creates a perl file from a template, makes the file executable, and invokes an editor in a single command. The template provides code for flags, usage, and help; comments which include author information, creation date, and RCS revision tags; and a basic pod template for creating perl's version of a man page. Think of it as "perl in a can".
Download newpl

ren-regexp>>  Click to open

Name ren-regexp
Version 1.6
Updated 2003/12/28 08:01:25
RCS ren-regexp,v 1.6 2003/12/28 08:01:25 forman Exp forman
Rating star star star star star
Category File manipulation
Description ren-regexp applies one or more regular expressions to a list of file names. This provides a method of applying common modifications to many files that would otherwise require repetitive, atomic file operations.

Download ren-regexp

ren-backup>>  Click to open

Name ren-backup
Version 1.6
Updated 2004/03/16 21:25:21
RCS ren-backup,v 1.6 2004/03/16 21:25:21 forman Exp forman
Rating star star star star star
Category System administration, File manipulation
Description This program adds a useful piece of metadata, the file backup date, as a suffix to the filename of a backed-up file.
ren-backup creates a backup by copying or moving the original file to a filename with a standardized suffix. This is most useful as a method of preserving configuration files prior to modification and has been designed to improve upon filenames of the genre "filename-" and "filename--" by using a file suffixed with an RFC-822 compliant date string ("filename-YYYY-MM-DD").
Download ren-backup

ren-renum>>  Click to open

Name ren-renum
Version 1.4
Updated 2003/04/05 05:44:24
RCS ren-renum,v 1.4 2003/04/05 05:44:24 forman Exp forman
Rating star star star no star no star
Category File manipulation
Description ren-renum renames files by renumbering digits in the filename. This is useful for renumbering files that contain sequential numbers in the filename such as with pictures.
Download ren-renum

ren-tolower>>  Click to open

Name ren-tolower
Version 1.1
Updated 2003/03/16 22:54:42
RCS ren-tolower,v 1.1 2003/03/16 22:54:42 forman Exp forman
Rating star star star star no star
Category File manipulation
Description ren-tolower renames files to all lowercase characters.
Download ren-tolower

massage>>  Click to open

Name massage
Version 1.4
Updated 2003/03/16 22:40:17
RCS massage,v 1.4 2003/03/16 22:40:17 forman Exp forman
Rating star star star star no star
Category Math, File manipulation
Description massage performs simple algebraic operations on columnar textual data. It is useful for scaling or offsetting rows of data before plotting. The user supplies a single operator followed by a list of numeric modifiers. The operator applies the numeric modifiers to their corresponding columns and prints out the result. It allows for the quick modification of text files holding data without the overhead of reading files into Matlab. It is designed to operate well with files containing text, either ignoring the text where needed or operating on numbers imbedded in the text.

Download massage

mp3-cd-write>>  Click to open

Name mp3-cd-write
Version 1.1
Updated 2003/03/16 22:40:59
RCS mp3-cd-write,v 1.1 2003/03/16 22:40:59 forman Exp forman
Rating star star star star no star
Category MP3, CDR
Description mp3-cd-write takes a list of mp3 files on the command line and burns them as CDDA tracks onto a CD. The resulting CD can be played in any standard audio CD player.
Download mp3-cd-write

mp3-cdr-fill>>  Click to open

Name mp3-cdr-fill
Version 1.2
Updated 2003/04/05 05:44:39
RCS mp3-cdr-fill,v 1.2 2003/04/05 05:44:39 forman Exp forman
Rating star star star star no star
Category MP3, CDR
Description mp3-cdr-fill fills a temporary directory randomly with mp3 files and burns it to a CDR. It will fill the directory with as much music as possible.

Download mp3-cdr-fill

mp3-ren-nice>>  Click to open

Name mp3-ren-nice
Version 1.1
Updated 2003/03/16 22:44:59
RCS mp3-ren-nice,v 1.1 2003/03/16 22:44:59 forman Exp forman
Rating star star star no star no star
Category MP3, File manipulation
Description mp3-ren-nice renames mp3 files such that they adhere to standard naming conventions. For instance a file named "artist-title_title.2.MP3" will be renamed to "Artist - Title Title.mp3".
Download mp3-ren-nice

mvcd-process>>  Click to open

Name mvcd-process
Version 1.12
Updated 2003/03/16 22:51:19
RCS mvcd-process,v 1.12 2003/03/16 22:51:19 forman Exp forman
Rating star star star star no star
Category Photography, File manipulation
Description mvcd-process is a multipurpose program designed originally to read photos off of a Sony Mavica CD 8-cm disk and create a digital photo album. The photo album consists of a directory containing the original pictures, pictures reduced in size to 640x480, thumbnails of the pictures, photographic indexes of all pictures and mpeg movies, and an html index file to explore the directories with a web browser.
In summary, the program in basic mode expects and provides the following:
Input: A finalized Mavica 8-cm CD with images and movies
Output: A photo album in a directory containing:

  • The original mpg movies
  • The original jpg pictures
  • The pictures at 640x480 suitable for emailing
  • The pictures at 240x180 to be used as thumbnails
  • The first frame of each movie at 240x180
  • Index pictures showing 24 images at a time
  • An html index file for viewing with a web browser


    Since the original inception of the program several extend modes have been developed. The extended modes and their functionality are as follows:

  • The ability to generate photo albums from sources other than a 8-cm Mavica CD.
  • The ability to interrupt the program and have it continue where it left off without redoing work that's already been done.
  • The ability to regenerate html files and index pictures to reflect a change in date or title.


  • Download mvcd-process

    www-getmp3>>  Click to open

    Name www-getmp3
    Version 1.1
    Updated 2003/03/16 23:05:41
    RCS www-getmp3,v 1.1 2003/03/16 23:05:41 forman Exp forman
    Rating star star star star no star
    Category WWW, MP3
    Description www-getmp3 fetches mp3 files from two of my favorite radio shows, "Democracy Now" and "Counter Spin". It's useful as a command line call or as an entry in one's crontab.

    Download www-getmp3

    rio-admin>>  Click to open

    Name rio-admin
    Version 1.1
    Updated 2003/03/16 22:55:44
    RCS rio-admin,v 1.1 2003/03/16 22:55:44 forman Exp forman
    Rating star star star star star
    Category MP3, Rio 500
    Description rio-admin provides four functions: format, erase, fill, and cycle. By default rio-admin peforms the fill function, which uploads random songs to a Rio 500. It will fill both internal and external memory using as much memory as possible with the given list of songs.
    This program requires the Rio500 programs and kernel module which can be found at http://rio500.sourceforge.net/.
    Download rio-admin

    pvr-record>>  Click to open

    Name pvr-record
    Version 1.2
    Updated 2003/03/16 22:53:17
    RCS pvr-record,v 1.2 2003/03/16 22:53:17 forman Exp forman
    Rating star star star no star no star
    Category Movies, DivX
    Description pvr-record encapsulates a variety of command-line options to transcode and nvrec for capturing and compressing v4l video on the fly.
    Download pvr-record

    biscuit3d>>  Click to open

    Name biscuit3d
    Version 1.2
    Updated 2002/12/08 05:04:33
    RCS biscuit3d,v 1.2 2002/12/08 05:04:33 forman Exp forman
    Rating star star star no star no star
    Category OpenGL, Fun
    Description biscuit3d is 3D visualization program created for fun and to gain experience in programming with perl's OpenGL module. The program places simple moving 3D objects into a environment with rudimentary collision detection, gravity, and friction. It's terribly addictive to play with and is recommended if you'd like to start dabbling with OpenGL and perl. It's only rated three out of five stars as it's a bit of an evolved kludge without much purpose. However, for fun it's a five out of five.
    The OpenGL-0.4 (not 0.5) perl module is required.
    Note that because this program is a true kludge thrown together for fun there is no additional documentation. There are however more command-line switches in this program than any other program I've ever written. In short you'll have to read some code to figure out what this thing does and how.
    Download biscuit3d




    Feature: Perl Code Feature: Iconography Feature: German-English Dictionary Feature: English Phonetic Transliteration
    Feature: This bunny studies you ... Feature: Mason HOWTO Feature: DHL Crash Landing Feature: Time-Lapse Movies

    Copyright © 2008 Michael Forman