Let’s assume that you are a Java server side programmer. Your current web project involves working with server side specific data, such as lots of media files which are stored in file storages, DB data, XML files, configuration files etc. All files are stored under proper sub-directories, your objects are beautifully mapped to DB using your preferable ORM like Hibernate. Another bunch of data is serialized to XML using something like xstream. Everything works like a charm, until the data storage format or convention is changed. For example, you decide to move all your pictures to another sub-folder. If you have references to these files in your DB you have to modify it too. Or, let’s say, in the next release of your product the textual data stored in the XMLs have to be updated to conform new POJOs which has new properties. What I’m trying to say here, is that if you develop an application which works with lots of non homogeneous data, you have to have an approach to migrate it from one version to another.
I think, that the best solution is using a script language which supports string parsing, SQL executing, file I/O. I chose Perl because of it well-known excellent work with regexps and good reputation between system administrators.
If you are a lucky user of the *nix OS, I believe, you don’t need any additional installation of the Perl, because it is already included in your distributive. For folks who are using Windows, I would recommend installing ActivePerl – Perl binary distribution for Win32 platform. Basically, I don’t know any other, and this one seems to be the best. Installing is a well-known “Next-Next-Next” joy.
My current IDE for Java is Eclipse. And one of great advantages of this famous IDE is it plugin system. There are lots plugins developed by different people almost for every purpose. The first plugin I found was EPIC – open source Perl IDE. Using this plugin you obtain simple but powerful facilities for Perl programming. It is a code highlighting and intellisense while typing, running a program by clicking right mouse-click on a perl source code file and choosing “Run as perl”. Output of the program is directed to Eclipse console. And of course, you can debug the program if output is helpless.
Finally, I’d like to emphasize the very useful tool which is supplied with ActivePerl – Perl Package Manager. Once you need any additional Perl package, you can easily install it in your system from the global repository.
For instance, you write a simple script which use B connection to a MySQL instance. But there is an error:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right.
The only thing you have to do, is to open Perl Package Manager, find missed in standard configuration package DBD::mysql, and install it.
Roadmap of this guide
Today I decided that writing less but more frequently is easier and using his approach I don’t need keeping this important post still in drafts. I’d rather ship every day part by part than wait for another month to complete it.
Therefore, I’m planning to cover in the near weeks these topics:
- String manipulation
- Files manipulation
- DB work
- XML work
- SQL generating