Subject: | Unneeded warning sent when checking for file inclusion |
Hi,
Your module includes a "contains_file" method, quite useful IMHO - But
by the way it is implemented, it can lead to unneeded garbage being sent
to STDERR. After all, when you call contains_file, it is because you are
not certain whether the file is contained or not :)
A user filed this bug quite a long time ago on the Debian package:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=318497
Today I closed it by applying the patch I'm attaching here. I tried to
steer away from your code as little as possible - Although I'm
manipulating the $WARN variable, which you mention is not a thread-safe
thing to do. All the other places where _find_entry is called are IMHO
fine this way - but this particular function is _expected_ not to find
the requested file every now and then.
I could have otherwise replaced the function body with something like this:
sub contains_file {
my $self = shift;
my $file = shift;
return 1 if grep {$_ eq $file} $self->list_files;
return 0;
}
This would, however, be a bit dangerous when the file list is _really_
large - Of course, looking quickly into _find_entry, it looks similar to
what's already being done there. Anyway, by doing it in this fashion,
$file could be not only the exact filename, but it could be a regex or
something more intelligent.
Thanks a lot,
Subject: | 10_dont_warn_when_only_checking.dpatch |
Message body not shown because it is not plain text.