Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: File::Binary and Carriage-Return issue

by mickeyn (Priest)
on Mar 04, 2009 at 13:23 UTC ( [id://748138]=note: print w/replies, xml ) Need Help??


in reply to Re^2: File::Binary and Carriage-Return issue
in thread File::Binary and Carriage-Return issue

this short version recreates the problem on my machine (unmark the binmode line to compare to the fixed output):
use strict; use File::Binary qw{$BIG_ENDIAN}; my $data = []; for (0..100) { $data->[$_] = 0x0a; } my $fb_dst = File::Binary->new("./a"); $fb_dst->set_endian(2); # 2 is $BIG_ENDIAN... fast fix $fb_dst->open(">./a"); #binmode $fb_dst->{_fh}; # unmark this line to fix problem $fb_dst->seek(0x0); my $index = 0; do { $fb_dst->put_ui8($data->[$index++]); } while ($fb_dst->tell() < 0xff);
Thanks for your help,
Mickey

Replies are listed 'Best First'.
Re^4: File::Binary and Carriage-Return issue
by ikegami (Patriarch) on Mar 04, 2009 at 13:27 UTC

    Don't post program you didn't actually run!!!!

    Update: I can't trust your observations, and I can't replicate them either.

    There's a bug in File::Binary that makes it incapable of exporting symbols. I switch to using

    # Useless since we only output bytes. $fb_dst->set_endian($File::Binary::BIG_ENDIAN);

    Then I get

    >debug file -rcx CX 00FF : -d100 lff 0B05:0100 0A 0A 0A 0A 0A 0A 0A 0A-0A 0A 0A 0A 0A 0A 0A 0A ......... +....... 0B05:0110 0A 0A 0A 0A 0A 0A 0A 0A-0A 0A 0A 0A 0A 0A 0A 0A ......... +....... 0B05:0120 0A 0A 0A 0A 0A 0A 0A 0A-0A 0A 0A 0A 0A 0A 0A 0A ......... +....... 0B05:0130 0A 0A 0A 0A 0A 0A 0A 0A-0A 0A 0A 0A 0A 0A 0A 0A ......... +....... 0B05:0140 0A 0A 0A 0A 0A 0A 0A 0A-0A 0A 0A 0A 0A 0A 0A 0A ......... +....... 0B05:0150 0A 0A 0A 0A 0A 0A 0A 0A-0A 0A 0A 0A 0A 0A 0A 0A ......... +....... 0B05:0160 0A 0A 0A 0A 0A 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:0180 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:0190 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:01A0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:01B0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:01C0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:01D0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:01E0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ......... +....... 0B05:01F0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 ......... +...... -q

    as expected.

    Windows and version 1.7

      sorry about that, couldn't share the original code...

      I corrected the code above - ran it and it does recreate the problem on my Windows:

      % hexdump a 0000000 0a0d 0a0d 0a0d 0a0d 0a0d 0a0d 0a0d 0a0d * 00000c0 0a0d 0a0d 0a0d 0a0d 0a0d 0000 0000 0000 00000d0 0000 0000 0000 0000 0000 0000 0000 0000 * 00000f0 0000 0000 0000 0000 0000 0000 0000 0000 00000ff
      Mickey

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://748138]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-16 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found