perl on CentOS 4.4 : PERLIO=perlio vs stdio, readline error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I sometimes use an example from readline entry in perlfunc(1).
This used to work for me, but know (after I upgraded to CentOS)
works only if PERLIO=stdio is defined in environment. See the following:

[xx@xx testreadline]$ cat testreadline.pl
#!/usr/bin/perl
use warnings;
use strict;
for my $fn (@ARGV) {
  local (*F);
  open F, "< $fn" or die "open err for fn=$fn: $!";
  binmode(F);
  my $c = 0;
  local $/=\8192;
  local $_;
  for (;;) {
    undef $!;
    unless (defined($_ = <F>)) {
      die $! if $!;
      last;
    };
    $c += length $_;
  }
  close(F) or die "close err fn=$fn: $!";
  print "fn=$fn, byte count=$c;\n";
}

[xx@xx testreadline]$ env LANG=C perl testreadline.pl testreadline.pl
Bad file descriptor at testreadline.pl line 14, <F> chunk 1.
[xx@xx testreadline]$ env LANG=C PERLIO=perlio perl testreadline.pl testreadline.pl
Bad file descriptor at testreadline.pl line 14, <F> chunk 1.
[xx@xx testreadline]$ env LANG=C PERLIO=stdio perl testreadline.pl testreadline.pl
fn=testreadline.pl, byte count=390;


Is the method of checking for errors with readline described in perlfunc(1)
no longer good?

Any hints would be most welcome.

Best regards,

Wojtek

BTW.

Perl installed is as follows:

[xx@xx testreadline]$ rpm -qi perl
Name        : perl                         Relocations: (not relocatable)
Version     : 5.8.5                             Vendor: CentOS
Release     : 36.RHEL4                      Build Date: Sun 13 Aug 2006 12:25:48 AM CEST
Install Date: Fri 15 Sep 2006 10:42:26 AM CEST      Build Host: build-i386
Group       : Development/Languages         Source RPM: perl-5.8.5-36.RHEL4.src.rpm
Size        : 32713959                         License: Artistic or GPL
Signature   : DSA/SHA1, Sun 13 Aug 2006 02:56:06 PM CEST, Key ID a53d0bab443e1821
Packager    : Johnny Hughes <johnny@xxxxxxxxxx>
URL         : http://www.perl.org/
Summary     : The Perl programming language.

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux