- Perl Application Library -

  

 

 

 

 

HAL Perl script library

 

Perl (Practical Extraction and Report Language) is one of, if not the most popular programming languages ever written. It is free and readily available for any computer system. Beyond that, there are immense numbers of free, public domain programs which may be used and adapted for almost any task.

 

Perl was first used to extend HAL by adding a "screen scraper" to allow one to go to any web page and retrieve data. We have programs here for tasks as diverse as checking Yahoo Weather or AccuWeather sites for weather conditions and forecasts, to retrieving information about the upcoming Star Trek Enterprise episode. The latest addition to the site is a new tutorial on writing your own screen-scraper.

 

Perl can be used to act on HAL Flags and to return data to HAL via flags as illustrated in Windy.pl, where the weather report from AccuWeather is used to decide when it is too windy for sprinklers or motion detectors to operate.

 

When not scraping screens to retrieve web data, perl can be used for more mundane tasks as illustrated by the program How Many Days (hmd.pl) which checks a database file of future holidays and allows HAL to tell you when the next holiday is upcoming.

 

Individual users are strongly encouraged to submit their own perl creations to us for incorporation on this page.

 

A recent addition to the library is a program for doing serial I/O to control a WGL Designs V572 Receiver. This program allows HAL to dynamicly enable and disable wireless X10 zones on demand.

 

This makes the state of the receiver mirror state of flags in HAL that correspond to the V572 zones used for wireless I/O.

 

Another script, called Sass, is designed to allow the definition of many canned responses to a single fixed event. The individual responses are given a weighting which controls how often each response will come up on a semi-random basis. Each response can be either a text string, a wav file, or both. The weight of each response can be modified by designating a HAL flag as a modifier. When the flag is true, the weighting of the response is increased or decreased, making it more or less likely to appear.

 

our Perl Engineering Notebook offers some tips for making your perl programs more elegant and sophisticated. While not a tutorial, it does offer useful information for the perl beginner.