A warning is just what is says. It is warning you about a potential problem with your code. Now you could just suppress it and hope that it's not warning you about a serious error[1]. Or you could investigate it and put right whatever is causing the error.
In this case you're probably using a variable that you haven't put any data into. Fixing the problem might well be as easy as initialising the variable with an empty string.
[1] And if you want to do that then perllexwarn will show you how.
--
< http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
| [reply] |
| [reply] |
It is not an error but a warning, so you can "hide" it by not activating warnings. I have seen this type of error many times, but other than it is estheticaly not pleasing, it does not necessarily mean that something is badly wrong. IMO, all it means is that you were using a variable before it was properly initialised, IOW the variable exists but has no content (yet): so either there is something wrong with the logic flow of your program or you indeed intended to use the variable without content. I have seen it sometimes appear in complicated print statements which internally are complied as a lot of concatenation operations. Lots of times however it is mostly harmless.
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] [d/l] |
It is not an error but a warning, so you can "hide" it by not activating warnings
In my opinion, hiding warnings is a terrible idea. And the worst way to do it is to just remove use warnings from the code. That stops you from knowing about any warnings that might appear anywhere in your code. That sounds like coding without a safety net for no good reason.
If you do have a piece of code where you want to "hide" a warning then just hide that specific warning in that specific piece of code. In this instance, that might look a bit like this:
{
no warnings 'uninitialized';
print start_html(...);
}
That way you still get the benefit of use warnings throughout most of your code.
--
< http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
| [reply] [d/l] |
I fully agree with your point of view. It is only once you have ascertained that the warning has no cause in a programming error that you should "hide" it.
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] |