Well, in this script I got a list of files with a simple glob() since it was convenient for various reasons. Note that I did some more filtering with a more fine-tuned regex as well, so that I may have done a readdir() myself or a glob '*'. However that's not what I did in the first place.
Now, it happened that the format of the filenames changed in the meanwhile, so I changed both the regex and a line of code like
tomy @logs=glob $pat;
(well, not exactly, but that gives the idea.)my @logs=map glob($_), $pat1, $pat2;
What happened then? That after these appearently innocent modifications, that long tested and trusted program began to spit out severe errors with quite unpleasant side effects (due to the nature of the other actions the program takes).
What was the problem? Simply, as it later occurred to me, that I had duplicates in @logs and since one of the actions taken by the program is to move such files around, well, it happened that I did things like statting inesistent files and stuff like that...
Well, the problem is resolved now. I just felt like sharing this story of a bad mistake I made. I'm not really sure it would help, for I'm sure I will continue to make stupid mistakes and, hey, I bet you will as well! <g> However... be cautious!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A story of two glob()s
by nimdokk (Vicar) on May 04, 2005 at 14:51 UTC | |
by blazar (Canon) on May 05, 2005 at 08:26 UTC |