Tuesday, 13 August 2013

A Look at Touching Files

Last time, I created a function to determine if a target file was out of date with respect to its sources. Now I want a function similar to UNIX' touch(1) that will update the atime and mtime of a file. And, like touch(1), it should be able to create empty files. The way to do this is to use Perl's utime function, which is based on UNIX' utime(2) function.

Monday, 29 July 2013

A Look at Finding Out-of-Date Files

On occasion, I need a script that will updates reports but only when the sources have changed. This is typically creating an XML file from log files or creating a static page for a web site. Here is a function to determine if the sources have changed after the last time the report was created.

Thursday, 25 July 2013

A Look at Dumping

I used Data::Dumper a lot but it leaves something to be desired. By adding a function to MyUtils.pm, a simpler interface can be achieved.

A Place for the Tests

In a previous article, I created an empty module for some utilities. Now is the time to populate it...and to develop tests for the subroutines.

Friday, 12 July 2013

A Look at Conditional Compiling of Diagnostics

From time to time, I add diagnostic messages to be printed by my code so I can track what the program is doing. I often wondered if there was a way to get Perl to conditionally compile these statements and to get it to do so automatically. Here's how:

Sunday, 7 July 2013

A Look At My Utility Library

Although there are many useful utility subroutines in Perl's standard modules, there are some that are missing. I'm going to spend the next few posts describing a few.