Skip Menu |

This queue is for tickets about the RTF-Tokenizer CPAN distribution.

Report information
The Basics
Id: 82697
Status: resolved
Priority: 0/
Queue: RTF-Tokenizer

People
Owner: Nobody in particular
Requestors: don.huettl [...] grantstreet.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.13
Fixed in: (no value)



Subject: Eliminate warnings when EOF is reached.
Currently the logic to read from a RTF document tries to append to the buffer without checking whether any data was actually received, which results in uninitialized variable warnings. This patch adds a couple of checks to avoid triggering those warnings.
Subject: RTF-Tokenizer-1.13-uninit-warning.patch
--- Tokenizer.pm.bak 2012-08-27 11:55:40.000000000 -0400 +++ Tokenizer.pm 2012-08-27 11:57:30.000000000 -0400 @@ -194,18 +194,15 @@ sub _get_line { my $self = shift(); - # Turn off warnings for the rest of this sub (at some point I'll upgrade - # to 'no warnings "uninitialized"', but don't want to force a Perl version - # on people yet) - local ($^W); - # Localize the input record separator before changing it so # we don't mess up any other part of the application running # us that relies on it local $/ = $self->{_IRS}; # Read the line itself - $self->{_BUFFER} .= $self->{_FILEHANDLE}->getline(); + if ( my $line = $self->{_FILEHANDLE}->getline() ) { + $self->{_BUFFER} .= $line; + } } # Determine what kind of line-endings the file uses @@ -373,6 +370,7 @@ # If we were read from a file, try and get some more stuff # in to the buffer, or return the 'eof' character + return ( 'eof', 1, 0 ) if $self->{_FILEHANDLE}->eof; $self->_get_line; return ( 'eof', 1, 0 ) unless $self->{_BUFFER}; }
Applied, released as 1.15, thanks