August 25th, 2009

Praise To A Perl Module

For as long as our design agency owns a fileserver, which is approximately three years, a little program written in Perl eases our daily lives at the office. It makes heavy use of Linux::Inotify2, an immensely useful module.

We have a samba-share on our fileserver, which contains a directory for each of our clients. Whenever anyone in our office creates a new folder inside this directory its name ist automatically checked and a three letter acronym is generated from the clients name. This abbrevation will be used internally to identify files related to the client given.

Once the new folder ist created it itself is also watched by the program and whenever a project folder is created within this clients folder, a directory hierearchy is copied into the project directory which looks similar to this:

00_communication
01_projectmanagement
02_design
03_implementation
04_final

This is very helpful, since nobody has to remember to create a “corporate folder structure”, which can also be understood by his or her co-workers. This is crucial if, for example, a client requests data while one of our colleagues is on vacation (and in this business you always need to find such things instantly).

With Perl being the almighty programming language it is, the usefulness of the module doesn’t end at here. You can really trigger anything with it. One could create a folder which synchronises its contents with a remote directory on a ftp-server the moment sombody drops data into it.  Or you can have the system email you about an activity regarding certain files, regarding security issues and the like.

The possibilities are endless.