develooper Front page | perl.perl5.porters | Postings from October 2003

Formats

From:
H.Merijn Brand
Date:
October 27, 2003 10:37
Subject:
Formats
Message ID:
20031027190225.9A27.H.M.BRAND@hccnet.nl
The last paragraph of perlform sais

--8<---
      Inside of an expression, the whitespace characters \n, \t and \f are
      considered to be equivalent to a single space.  Thus, you could think
      of this filter being applied to each value in the format:

       $value =~ tr/\n\t\f/ /;

      The remaining whitespace character, \r, forces the printing of a new
      line if allowed by the picture line.
-->8---

I know nobody cares, but why is \e treated as whitespace? It's not in these
docs, and I cannot think of a valid reason to strip escapes, other than ...
way back when we had paper terminals ...

l1:/pro/3gl/CPAN/perl-current 157 > perl5.8.0 -MO=Deparse merijn/fmt.pl
$_ = "\eE";
format STDOUT =
@<<<<<<<<<<<<<<
$_
.
write;
merijn/fmt.pl syntax OK
l1:/pro/3gl/CPAN/perl-current 158 > perl5.8.0 -MO=Concise merijn/fmt.pl
e  <@> leave[t1] vKP/REFC ->(end)
7     <0> enter ->8
8     <;> nextstate(main 1 fmt.pl:3) v ->9
b     <2> sassign vKS/2 ->c
9        <$> const(PV "\033E") s ->a
-        <1> ex-rv2sv sKRM*/1 ->b
a           <$> gvsv(*_) s ->b
c     <;> nextstate(main 2 fmt.pl:10) v ->d
d     <0> enterwrite v ->e
merijn/fmt.pl syntax OK
l1:/pro/3gl/CPAN/perl-current 159 > perl5.8.0 -MO=Terse merijn/fmt.pl
LISTOP (0x4001e170) leave [1]
    OP (0x4002d650) enter
    COP (0x4001e128) nextstate
    BINOP (0x4001e0f8) sassign
        SVOP (0x4001e088) const  PV (0x4001a428) "\033E"
        UNOP (0x4001e058) null [15]
            SVOP (0x4001e028) gvsv  GV (0x4001a314) *_
    COP (0x4002d608) nextstate
    OP (0x4002d5e0) enterwrite
merijn/fmt.pl syntax OK
l1:/pro/3gl/CPAN/perl-current 160 > perl5.8.0 merijn/fmt.pl | cat -ve
 E$
l1:/pro/3gl/CPAN/perl-current 161 >

enterwrite calls S_doprint which calls CvSTART where I'm lost
I don't see the point (yet) where the \n\r\t\e are tr'd to space

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0, & 5.9.x, and 806 on  HP-UX 10.20 & 11.00, 11i,
   AIX 4.3, SuSE 8.2, and Win2k.           http://www.cmve.net/~merijn/
http://archives.develooper.com/daily-build@perl.org/   perl-qa@perl.org
send smoke reports to: smokers-reports@perl.org, QA: http://qa.perl.org




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