develooper Front page | perl.perl5.porters | Postings from November 2014

[perl #4842] Print x1b works. Write x1b fails

Thread Previous
From:
James E Keenan via RT
Date:
November 13, 2014 02:31
Subject:
[perl #4842] Print x1b works. Write x1b fails
Message ID:
rt-4.0.18-5165-1415845883-3.4842-15-0@perl.org
On Tue Dec 05 05:19:07 2000, Richard.HARDWICK@cec.eu.int wrote:
> To: perlbug@perl.com
> Subject: Print \x1b works. Write \x1b works in perl 4, fails in perl 5
> Reply-To: richard.hardwick@cec.eu.int
> 
> This is a bug report for perl from richard.hardwick@cec.eu.int,
> generated with the help of perlbug 1.28 running under perl v5.6.0.
> 
> # Can we write the HP control character dec 27 (== hex 1B == CTRL [ ==
> ESC)
> # In perl 4 yup
> # In perl 5 of any flavour nope
> 
> use strict;
> use utf8;
> my $hpcode;
> $hpcode="\x1b";
> write STDOUT ;
> print STDOUT "Here is hpcode by a print [$hpcode]\n";
> 
> format STDOUT_TOP =
> Here we are inside a format
> .
> format STDOUT =
> Here is hpcode by a write [@<<<<<<<]
>     $hpcode
> .


There has been documentation in pod/perlform.pod since commit a1b950687051c32e26de8681b0ed639ad32adfb4 in January 2004 as to why this is the case.  In perl-5.20 it reads:

#####
Within strings that are to be displayed in a fixed-length text field,
each control character is substituted by a space. (But remember the
special meaning of "\r" when using fill mode.) This is done to avoid
misalignment when control characters "disappear" on some output media.
#####

So, is there anyone who believes we should try to implement the feature modification requested in this ticket nearly fourteen years ago?

Thank you very much.


-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=4842

Thread Previous


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