|No such thing as a small change|
How Perl saved my night...by bronto (Priest)
|on Feb 19, 2004 at 17:29 UTC||Need Help??|
This week I am on on-call service.
A few days ago I received an e-mail from the networking group stating that a network reconfiguration will take place tomorrow morning, between 2:00AM and 7:00AM, and the presence of the on-call engineer (me!) was required to check that all our systems that offer services on the Internet will work correctly after the reconfiguration.
I took the networks list involved in the reconfiguration, and passed it to my colleagues asking who managed services on them and how their functionality should be checked (it's not a long time I work here, some things are still unknown to me). It came out that many of those services could be tested by simply trying an HTTP/HTTPS connection, or some DNS queries, while others have to be checked by the network staff directly. So, if network staff could check those connections and queries in a simple manner, I could probabily go to bed instead!
Mmmmhhh... this looks like a good job for Perl! But to make them run a script correctly I had to make sure that all the needed modules were there, the same way that happens when you install a new module...
et voilà! Let's edit the makefile:
Good. I decided to use the Reconfig.pm file just to store the $VERSION variable and a minimal POD documentation. I'll omit the source.
And now the big part: the tests. The t/Local-Network-Reconfig.t file:
Ok, so doing perl Makefile.PL, make and make test actually verified that the services were working correctly. In case of problems one could simply run perl -Mblib t/Local-Network-Reconfig.t and read the verbose output of the test script
So, what I missed? Oh, yes! The README file!!!
Good: I packaged the scripts with make dist, sent the tar.gz file by e-mail to the network staff and showed them how to use it. And they said that the procedure is so simple that they don't need me tonight!!!
So... good night, netstaff; good night, monks. And... good night, Perl
The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).