Home

Advertisement

Customize

Jun. 9th, 2008

bob

Today At Work

As already mentioned, I worked from home all day, for the most part on one particular little program originally created by a former employee. For some bizarre reason (or if not bizarre, at least no longer known) it lived in the /tmp direct. I assume that the machine is not set up to clear the /tmp directory upon rebooting, but who knows ... the system has an up time of something like 1600 days. (actually upon just looking, its *only* an uptime of 1069 days, and the program was last edited in 2005, so it appears to be a safe assumption).

Anyway, the purpose of the script was to find an appropriately sized subnet amongst a given IP block that was available to allocate to a client. There are plenty of smarter ways to work this issue out, but for various reasons they have not been implemented yet ... but that is something some of us are working on.

Anyway, I've only rather recently become aware of and had to begin using this script. When I did so on Saturday, and it took over four minutes to complete, I decided it was time for a bit of a rewrite. On Saturday I had decided this was an excellent excuse to again begin to increase my understanding and to finally use POE. I began reading the docs for POE::Component::Client::Ping, but it ended up being a busy day so I didn't get much further. Today I decided it was better to first move most of the work into a module, without making too many changes to how it already works. The biggest change I made (with the most satisfying results) was to remove the call to the system's ping, and instead use Net::Ping. Along with a few other minor changes, the same task took over four minutes was down to under 40 seconds. That is still not ideal, but is still much less painful. Of course, I think I spent more time with figuring out what tests to write (I didn't get very far there), and working with the 'infrastructure' of creating a module (something I'm still can't do without reading documentation). I also spent a fair amount of time thinking of how best to integrate this with our 'helpdesk' web application. As it currently stands, after obtaining the list of subnets that appear to be available, we have to search the client database to ensure that it actually is ... a step that could easily be automated ( ... of course, that in no way ensures that the data is actually kept up to date, but I am still struggling with an answer to that problem).

Advertisement

Customize