vickycanada:
Generally, you'd just check whether they all exist, then do your thing. For example:
my $XXX = ... from somewhere ...;
if (-e "$srcDir/alphat.$XXX.zip" and -e "$srcDir/numerict.$XXX.zip" an
+d -e "$srcDir/updatet.$XXX.zip") {
# all files are found, so go do some work
}
else {
# Not all files are present yet.
}
Generally, that's the easy part. For a real task, files won't always show up simultaneously. So you'd have to scan your input directory for files and extract a list of XXX values from them. You can use that list in a for loop with the above code to process any group where all three XXX parts exist.
The harder bit comes where you need to allow some time to pass before declaring an error and causing someone to go in and debug the situation. To do so, I'd suggest tracking the current time when you find a new file, and then in your chunk where you don't have all files present, you can compare the current time with the time that the file was discovered, and if enough time has elapsed, then emit a warning with the files that are missing. You'll also likely want to stash away those files so they don't keep warning you. But that's the fun of making a production system.
Update: Changed -E to -e (thanks for catching that, choroba!)
...roboticus
When your only tool is a hammer, all problems look like your thumb. |