As I've been pondering what I want from CPAN::Reporter's history log
for a smoke server, I've started to consider changing the log
structure yet again.  (The last change was to add perl version to the
normal data that would be in the Test::Reporter subject line.)

Right now, the major limitation is that the log file works like this:

* linear search of log file for duplicate
* append log record line for sent reports

Some things that I (or others) think would be nice:

* timestamps
* log aborted/discarded reports (e.g. missing prerequisites)
* indexed instead of linear search (which gets ugly as logs grow to
thousands of lines)

The first two are easy, but the third is a bit harder.  I don't want
to introduce any database dependencies if at all possible -- even
things like DB_File.  It's just not portable enough.

What occurred to me, though, is that every OS has a sort of built-in
database in the file system.  So I'm considering changing to store a
"record" as an empty file with a well-defined pathname based on the
components that define a unique test report.  E.g.:

  $record = File::Spec->catfile(
    $config_dir,
    'log',
    $perl_version_with_optional_patchlevel,
    $Config{archname},
    $Config{osvers},
    "$dist_name-$dist_version",
    "$grade"
  );

That would allow a quick check if a distribution has been tested at
all with just -d to the correct directory.  Files already get
timestamped on creation, so reverse sorting the files would easily
give the latest grade (or I could use "$epochsecs-$grade" for more
control).

Adding a new log entry is just mkpath and creating an empty file.  For
discarded reports, I'd use "DISCARD" as the grade.

Any thoughts on this approach -- particularly potential pitfalls?
Things I'm already thinking about include:

* probably can't have all dists in one directory -- so need
$author/$dist-$version or $author/$dist/$version or even
$initial/$author/$dist/$version

* total pathname length limits?

* odd OS system portability issues (e.g. VMS?)

Thanks for your input!

David

Reply via email to