develooper Front page | perl.perl5.porters | Postings from March 2011

Re: serious PerlIO trouble :(

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
March 12, 2011 01:23
Subject:
Re: serious PerlIO trouble :(
Message ID:
20110312102321.2f74901e@pc09.procura.nl
On Wed, 9 Mar 2011 09:50:00 +0100, "H.Merijn Brand"
<h.m.brand@xs4all.nl> wrote:

> See also RT#66474 - https://rt.cpan.org/Ticket/Display.html?id=66474
> 
> I'll just post the results here first. I'll have to start digging later
> Test script and data attached

I think it boils down to something like this:

$ dump rt66474.csv
[DUMP 0.6.01]

00000000  FF FE 68 00 65 00 6C 00  6C 00 6F 00 2C 00 77 00    ..h.e.l.l.o.,.w.
00000010  6F 00 72 00 6C 00 64 00  0D 00 0A 00 68 00 65 00    o.r.l.d.....h.e.
00000020  6C 00 6C 00 6F 00 2C 00  74 00 77 00 6F 00 0D 00    l.l.o.,.t.w.o...
00000030  0A 00 68 00 65 00 6C 00  6C 00 6F 00 2C 00 74 00    ..h.e.l.l.o.,.t.
00000040  68 00 72 00 65 00 65 00  0D 00 0A 00                h.r.e.e.....

$ cat perlio.pl
#!/pro/bin/perl

use strict;
use warnings;

my $t = shift || 0;

use open IN => ":encoding(UTF-16) :crlf";
@ARGV = "rt66474.csv";

if ($t == 0) {
    print <>;
    exit 0;
    }

if ($t == 1) {
    require IO::Handle;
    while (my $r = *ARGV->getline) {
        print $r;
        }
    exit 0;
    }
$ perl perlio.pl 0
hello,world
hello,two
hello,three
$ perl perlio.pl 1
UTF-16:Unrecognised BOM 7061 at /pro/lib/perl5/5.12.2/i686-linux-64int-ld/IO/Handle.pm line 1.
Compilation failed in require at perlio.pl line 17.
Exit 255
$



-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About