Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

perlio fileno fallback

0 views
Skip to first unread message

Kevin Ryde

unread,
Aug 15, 2008, 9:43:49 PM8/15/08
to
I'm contemplating getting Term::Size to cooperate with PerlIO. It's
just an xsub which does an ioctl, and currently it's setup to take a
FILE* and then use fileno() to get the fd. But with the debian perl
5.10.0 the typemap for FILE* calls PerlIO_findFILE, and that func has
the unhappy effect of knocking out any :utf8 flag on the stream. Eg.

use strict;
use warnings;
use Term::Size;
binmode STDOUT, ':utf8' or die;
print "\x{263A}\n";
Term::Size::chars(\*STDOUT);
print "\x{263A}\n";

=> Wide character in print at foo.pl line 7

I get the effect I want by changing to PerlIO* and PerlIO_fileno, but
ppport.h warns that PerlIO_fileno (and PerlIO_stdin) aren't portable
before 5.7.3, even with ppport.h in use.

Is there something hiding in the docs on this sort of thing?

I saw fakesdio.h which looks pretty promising for upward and downward
compatibility, but perlio.h seems to always make a define of
PERLIO_NOT_STDIO, thus never getting to the fakesdio.h case.

Kevin Ryde

unread,
Aug 16, 2008, 7:17:33 PM8/16/08
to
I wrote:
>
> ppport.h warns ...

Ah, no, of course, it lies, or only means there's no actual layers
before then ...

0 new messages