
On 12/23/05, Uwe Voelker
Hello,
in Kernel::System::Time line 236 Perl issues a warning "Use of uninitialized value". It is this code snippet:
# match mail time format elsif ($Param{String} =~ /((...),\s+|)(\d\d|\d)\s(...)\s(\d\d\d\d)\s(\d\d|\d):(\d\d|\d):(\d\d|\d)\s((\+|\-)(\d\d)(\d\d)|...)/) { my $DiffTime = 0; if ($10 eq '+') { # $DiffTime = $DiffTime - ($11 * 60 * 60); # $DiffTime = $DiffTime - ($12 * 60); } elsif ($10 eq '-') { # $DiffTime = $DiffTime + ($11 * 60 * 60); # $DiffTime = $DiffTime + ($12 * 60); }
The warning is in the line with "if ($10 eq '+') {" because $10 is undef.
What is the regexp supposed to match? Why is there a pipe symbol after "/((...),\s+" and before the ")"? Could this be the problem?
It matches the beginning of a date in a mail message. ie: Date: Thu, 22 Dec 2005 23:07:24 -0500 (EST) The 'pipe symbol' is a logical OR. That part of the regexp says "anything followed by a space OR nothing". I think the whole if/elsif block should be commented out, since it's not actually doing anything. It looks like the regexp has changed number of parameters since the if/elsif block was last used (I can't see how $10 would ever be + or -, isn't it the first 2 digits of the timezone?). Bryan