Subject: | commit method does not use $self->_fh to access filehandle |
If the LogReader object is created and committed immediately without any
readline invocation in between, commit method will fail by reporting
nothing to commit.
After browsing the module code, I found *ONLY* commit method does not
use $self->_fh to access filehandle. Thus, it's impossible to commit
zero position when nothing is read. More important, it disallows one to
open the file, seek to some position and commit. In conclusion, I think
commit should use $self->_fh instead.
To reproduce my problem:
1. create bug.pl with the following lines
my $filename = 'test.txt';
my $lr = File::LogReader->new( filename => $filename );
$lr->commit;
2. run bug.pl
Sample output:
Nothing to commit! at C:/Perl/site/lib/File/LogReader.pm line 103.