Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

Small typo in perlsyn.pod #407

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#1242 (status was 'resolved')

Searchable as RT1242$

p5pRT commented 24 years ago

From hgin2088@mail.kolej.mff.cuni.cz

  There should be

  The `while' statement executes ... or `"0"').

istaed of ending or `"0")' in perlsyn.pod.

  In perlre.pod in the paragraph starting   `On simple groups\, ...' is somenthing also wrong with apostrophes or re's.

Subject​: Getting Locales - General Protection Fault

  The first example in the section   `The localeconv function' of   perllocale.pod makes General Protection Fault.

OS version​: Microsoft Windows 95. [Version 4.00.1111] Czech

Bash version​: 1.14.7 for DJGPP

Perl​: This is perl\, version 5.005_02 built for dos-djgpp   MS-DOS port Copyright (c) 1989\, 1990\, Diomidis Spinellis   djgpp v2 port (jpl5003c) by Hirofumi Watanabe\, 1996   djgpp v2 port (perl5004+) by Laszlo Molnar\, 1997-1998

  Last thing.

  Why @​a=('\x80'..'\xFF') does not create an array?

  Best regards\,

  _ Hans   \,~| |/ /~~~\, \,   | /| / . /   |/ |/~// // \~~ | _ / // ~~/ // /   /| /| / /_ / / \, \ \ / / / / / /~~~ /   ~ ~ ~ ' ' ~ ~|' ' ' ' ~~~ '   Hans GINZEL /| Room​: B509   Faculty of Mathematics / / Kolej 17. listopadu   and Physics ~~ Pa'tkova 3   Charles University Prague 182 00 Praha 8   MailTo​:Hans@​kolej.mff.cuni.cz CallTo​:++420+2+8551040-49/761

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

On Fri\, 20 Aug 1999 at 19​:00​:05 +0200\, Hans GINZEL wrote​:

There should be The `while' statement executes ... or `"0"'). istaed of ending or `"0")' in perlsyn.pod.

This one's easy​:

Inline Patch ```diff --- pod/perlsyn.pod.orig Tue Jul 20 18:18:10 1999 +++ pod/perlsyn.pod Sat Aug 21 11:05:29 1999 @@ -156,5 +156,5 @@ The C statement executes the block as long as the expression is -true (does not evaluate to the null string (C<"">) or C<0> or C<"0")>. The LABEL is +true (does not evaluate to the null string (C<""> or C<0> or C<"0">). The LABEL is optional, and if present, consists of an identifier followed by a colon. The LABEL identifies the loop for the loop control statements C, ```

In perlre.pod in the paragraph starting `On simple groups\, ...' is somenthing also wrong with apostrophes or re's.

What do you think is wrong? The source code 'C\s' to indicate multiple examples of 'a' isn't very clear; after pod2man->man it just reads 'as'\, which could certainly confuse non-native English speakers.

Subject​: Getting Locales - General Protection Fault OS version​: Microsoft Windows 95. [Version 4.00.1111] Czech

Sorry\, I personally can't help here - I neither have any interesting Locales nor Windows 95 perl. If you've built this perl from source\, you should be able to run 'perlbug' which will help you to submit an email with more info. You imply\, but don't state that you have the Czech locale set​: please be explicit\, try again with other locales and submit the bug again with 'perlbug'. If you didn't build the perl binary yourself\, you need to talk to whoever did.

Last thing. Why @​a=('\x80'..'\xFF') does not create an array?

Well\, it did; it's just that the array only has one element :-)

The auto-increment only works on numbers\, and ascii letters+numbers (see perlop). Hence the initial value is taken as 0\, incremented to 1 and compared with the '\xFF'\, which is also 0. Hence one array element.

What you need is​:   @​a = map { chr } 128..255;

There's an issue here​:   Should not ++ warn before converting junk into numbers?

At the moment { $x='?'; $x++; } silently leaves $x as '1'. Ilya (Cced) was arguing against my idea of "123\0foo" being recognised as a number without warning. Here we find '?' being regarded as the number 0 without warning.

Ian

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

On Tue\, 24 Aug 1999 at 17​:00​:08 +0200\, Hans GINZEL wrote​:

Hallo\.

Thank you for quick answer.

On Sat\, 21 Aug 1999\, Ian Phillipps wrote​:

On Fri\, 20 Aug 1999 at 19​:00​:05 +0200\, Hans GINZEL wrote​:

In perlre.pod in the paragraph starting `On simple groups\, ...' is somenthing also wrong with apostrophes or re's.

What do you think is wrong? The source code 'C\s' to indicate multiple examples of 'a' isn't very clear; after pod2man->man it just reads 'as'\, which could certainly confuse non-native English speakers.

Not\, that's not the problem. I've now looked in the source code (perlre.pod) and there is​:

On simple groups\, such as the pattern C\<(?> [^()]+ )>\, a comparable effect may be achieved by negative lookahead\, as in C\<[^()]+ (?! [^()] )>.

I think problem is in the first greather then symbol. It should be escaped.

This is fixed in 5.005_61.

I am working on Linux with Czech locales. It seems they do work in perl. I only wanted to test what about that on Microsoft Windows. I have expected\, that would be all English\, but not an crasch (protection fault). I had should write it direct to DJGPP's team. I noticed You have sent copy to perl5-porters. Thank you. I hope that was.

Messages from Perl are always in English\, sorry. If you compiled Perl from DJGPP yourself\, then it could be Perl\, or the compiler\, or your operating system at fault. Welcome to the perl bug-fixing fraternity :-)

There's an issue here​: Should not ++ warn before converting junk into numbers?

I think not. That is the definition of ++ and conversion of scalar to number. I also understand the magical function of ++​:

It was the conversion to numbers by '++' that I was querying. I don't think it's right that '?'->'1' is a valid '++' result. The alphabetic case of 'Z'->'AA' is quite separate.

that range "\<one 8-bit character>" .. "\<one 8-bit character>"

Sorry\, no. Suppose you are running Perl on an EBCDIC machine\, and specify 'A'..'Z'; what results? Perl does have DWIM (do what I mean) functionality in a lot of places\, but this one would add too much ambiguity.

Currently\, the '..' operator uses increment to get from one bound to the other; it's the only reasonable interpretation. Increment is not defined on characters\, since Perl doesn't work with characters like that. Definition of 'characters' is itself a minefield\, with Unicode and Locales interfering.

is well defined and should work same way as in Pascal.

Well\, if you want Pascal\, you know where to find it :-)

Ian