Skip Menu |

This queue is for tickets about the File-Binary CPAN distribution.

Report information
The Basics
Id: 6565
Status: resolved
Priority: 0/
Queue: File-Binary

People
Owner: Nobody in particular
Requestors: struan [...] exo.org.uk
Cc:
AdminCc:

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



Subject: Seeking failing. Also bad results under windows
Hi, Just to let you know that it doesn't play nice under windows as it gets confused with the while \n \n\r thing. If you do the binmode dance then it's all happy. Also as there's no second argument to seek it tends to bomb. patches attached. Sadly not tested as my cygwin install is fighting back :( Seems to work in the wild when you apply the patch to the previous version (which is what comes with active perl ).
Download diff
application/octet-stream 1.6k

Message body not shown because it is not plain text.

Date: Wed, 9 Jun 2004 17:45:35 +0100
From: Simon Wistow <simon [...] thegestalt.org>
To: Guest via RT <bug-File-Binary [...] rt.cpan.org>
Subject: Re: [cpan #6565] Seeking failing. Also bad results under windows
RT-Send-Cc:
On Wed, Jun 09, 2004 at 12:39:49PM -0400, Guest via RT said: Show quoted text
> > patches attached. Sadly not tested as my cygwin install is > fighting back :( Seems to work in the wild when you apply the > patch to the previous version (which is what comes with > active perl ).
Err, the patch looks like it's for some javascript. oStrBuff.append("<td align='left'>"+(rs.getValue('postcode')?rs.getValue('postcode'):'No postcode recorded')+"</td>"); - oStrBuff.append("<td align='center'><input id='viewRadio' type='radio' onclick='errors.innerHTML=\"\"' vDefault=true value='"+rs.getValue('id')+"' name=' address'></td>"); + oStrBuff.append("<td align='center'><input id='viewRadio" + count + "' type='radio' onclick='errors.innerHTML=\"\"' vDefault=true value='"+rs.getValue('i d')+"' name='address'></td>"); oStrBuff.append("</tr>"); + if ( !firstElement ) firstElement = 'viewRadio' + count; + if ( !g.focusOn ) g.focusOn = firstElement; Thanks for the heads up though. Simon
From: karl.forner [...] gmail.com
Hello, I also got into trouble with the seek method. I have a simple patch and a simplistic test to contribute if it can help you. Here's the patch: ================================================================= --- Binary.pm 2005-11-18 15:00:54.000000000 +0100 +++ Binary.pm.fixed 2005-11-18 15:00:33.000000000 +0100 @@ -158,12 +158,13 @@ sub seek { my $self = shift; my $seek = shift; + my $whence = shift || SEEK_SET; unless ($self->{_is_seekable}) { carp "FH is not seekable" if $DEBUG; return 0; } - $self->{_fh}->seek($seek) if defined $seek; + $self->{_fh}->seek($seek, $whence) if defined $seek; $self->_init_bits(); return $self->{_fh}->tell(); ====================================================== and here's the test: t/00seek.t ===================================================== #!perl -w use strict; use Test::More qw(no_plan); use File::Binary; use Data::Dumper; my $bin = File::Binary->new('t/le.fibonacci.n32.ints'); $bin->set_endian($File::Binary::LITTLE_ENDIAN); my %pos_2_value; foreach (1..10) { my $key = $bin->tell(); $pos_2_value{$key} = $bin->get_si32(); } foreach my $key (keys %pos_2_value) { $bin->seek( $key ); is( $bin->get_si32(), $pos_2_value{$key}); } $bin->close(); ========================================================== Thanks for your work. Karl Forner
Should be fixed now