Log::Parallel::Paths - variable expansion, capture, globs, regex on filenames
use Log::Parallel::Paths; $filename = path_to_filename($spec, %data); $glob = path_to_shell_glob($spec); ($regex, $closure) = path_to_regex($spec);
Within the batch log processing system, Log::Parallel, filenames are specified with magic cookies embeded in them. For example:
These magic cookes need to be expanded in various way: for making a new filename (
path_to_filename()); for handing to a shell to glob to look for files (
path_to_shell_glob()); for a perl regular expression to extract these parameters from a filename (
The magic cookies that are recognized are:
Format: %05d. The bucket number for this file.
Format: %05d. When one job writes to buckets, the next job will process each bucket separately, often in parallel. The new bucket for a bit of data may be different than the old bucket. The
SOURCE_BKT is the old bucket number.
Format: %04d. Year part of the end date for this data.
Format: %02d. Month part of the end date for this data.
Format: %02. Day part of the end date for this data.
Format: %02. Hour part of time.
Format: %04d. Year part of the beginning date for this data.
Format: %02d. Month part of the beginning date for this data.
Format: %02. Day part of the beginning date for this data.
The specification can have user specified formats. For
path_to_regex(), the key for the bit matched by the regex is word.
path_to_regex() function returns both a regular expression and a bit of code that will translate the positional matches (
$2, etc) into key/value pairs.
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.