This Week on p5p 1999/12/05
m//gin List Context
eof()at the Beginning of the Input
- Shadow Passwords Continue
- Perl, EBCDIC, and Unicode
- Change to
- Talarian SmartSockets
- Mailling List Archives Unavailable
- Perl Art
- Floating-Point Numbers
- Development Continues on Ilya’s Patches
- A Note About Bug Reports
I’m still catching up from my three consecutive trips. I hope to be back on schedule by Sunday.
You can subscribe to an email version of this summary by sending an empty message to
Please send corrections and additions to
YYYYMM is the current year and month.
m//g in List Context
Ralph Corderoy reported a non-bug: ``Assigning a
/gx regexp to a list breaks
\G in the following regexp.” His example went something like this:
$s = '123456'; ($a, $b) = $s =~ /(.)(.)/g; # line 2 ($c, $d) = $s =~ /\G(.)(.)/g; # line 3
$c to contain 3 and
$d to contain 4. Instead, they contain 1 and 2.
What happened here? In scalar context,
m//g finds one match, starting from where it left off. However, in list context, it finds all the remaining match, and returns a list of all the results. LIine 2 above matched and generated the list
(1,2,3,4,5,6). It assigned this list to
$b, throwing away 3, 4, 5, and 6; then the match on ilne 3 started over again at the beginning.
This recalled a similar complaint from Randal Schwartz, which I neglected to mention at the time.
Ilya Zakharevich: I remember some discussionfor making list context
m//gcbehave differently. What wasthe result?
Apparently the result was that it was forgotten. It might be nice to reopen this. As Ralph says, ``
/g means two things (many matches and enable
\G), it means you can’t just enable
His second message has a very clear statement of the problem, and a proposal for what to do instead. Read about it.
eof() at the Beginning of the Input
Ralph Corderoy also reported a bug in the
eof() gets my award for `obscure feature of the month.’ It is different from just
eof with no parentheses, because
eof by itself tests the last-read filehandle, but
eof() with empty parenthese tests the special null filehandle, the one read by
<>. Anyway, now the bug. If you call
eof() before you’ve read any input at all, it yields true, and Ralph thought it should yield false:
plover% perl -le 'print eof()' 1
A bunch of people then posted arguments about why this was actually correct behavior, or documented behavior, or how Ralph should work around it, or confused the issue with plain
Ralph: But shouldn’t
eof(), associated as it is with the magic
<>, have a little magic of its own and trigger the first getc+ungetc from
<>? Mb>Larry: Makes sense to me, as much as
eof()ever makes sense.
Sarathy then reported that
eof() was not even behaving as documented, and would in fact apply to the least-read filehandle even if it was not
ARGV. He then provided a patch that made it behave as documented and also fixed Ralph’s bug.
Shadow Passwords Continue
Discussion continued from last week about the behavior of Perl’s
getpw* functions on systems with shadow password files. I said that I’d follow up this week, but I think the summary I posted last time suffices. People argued about school #1 vs. school #2. Last week’s summary.
Perl, EBCDIC, and Unicode
Geoffrey Rommel asked for pointers to docmuentation about unicode support in Perl so that he could understand the implications for his
Convert::IBM390 module. He got two excellent responses: James Briggs is writing a document called `Perl, Unicode and I18N’ which he expects to have done by 7 January.
He also suggested that the techniques of the
utf8 pragma could be adapted to provide an analogous
utfebcdic pragma which would enable an EBCDIC internal representation.
Dan Sugalski observed that the
lock keyword is interpreted as a function name if there is any global variable
main::lock, even a scalar. In this case the
main::lock function is invoked. Sarathy supplied a patch which makes the determination at compile-time based on the existence of the subroutine
A few weeks ago, I reported on a new module,
Safe::Hole. Mike Heins posted a glowing testimonial for it, so I thought I’d mention it again.
Back in early November, I reported:
Ilya submitted a patch to
xsubppwhich will change the value return semantics of XSUBs to be more efficient. It needs wide testing because almost all XSUBs will be affected.
Sarathy said that it was risky enough that it should be enable only when explicitly requested; Ilya objected, saying that it needed wide testing and that if it were only enabled by a command-line argument it would not receive wide testing.
Nick Ing-Simmons then offered to test it with
Tk, but I did not see the outcome. Andreas K&omul;nig tested it with many important modules(including
Tk,) and reported that it caused no problems that were not already present.
Simon Cozens reported that Freshmeat had announced a programming language, `Euphoria’, which purported to be `simple, flexible, and easy to learn and outperforms all popular interpreted languages’. (No URL, unfortunately, just that it was in Freshmeat on 29 November.) Larry says that the benchmarks are somewhat cooked.
This sounds like a joke, doesn’t it? But Tim Bunce wants to know if there is a Perl interface for Talarian SmartSockets, whatever that is. If anyone knows, please mail Tim, or send me your message and I will forward it.
Ilya made some substantial additions to the
perlxstut man page. He added a section on troubleshooting the examples in the document, and some notes about how to detect old versions of Perl. He added a lot of details about the contents of
.xs files and the generated
Sarathy edited the prose in the
perlxs changes and added some additional text. He also suggested that it could use some going-over by other people.
Norbert Goevert reported a bug in the way that
ExtUtils::Install handles setting the
umask value. This spawned a brief discussion of why
ExtUtils::Install was setting the
umask in the first place, and therefore specifically overriding the permission policy specified by the person running the script. Sarathy agreed, and patched
ExtUtils/Manifest.pm to leave the
umask alone. Hoewever, he said that the right approach would be for these programs and modules to check for an inappropriate
umask value and issue a warning if it was set to something suspicious. He asked for a patch that would do this, but nobody contributed one. Nick Ing-Simmons suggested an alternative approach:
Configure could ask something like
Should I honor your umask (currently 060) during installs?
Achim Bohnet, who maintains the p5p mailing list archive at
www.xray.mpe.mpg.de, reported that it would be unavailable between 31 December and 2 January. Chaim Frenkel noted that the list is being archived at
Ilya posted the locations of some web resources he recommended for people interested in floating-point numbers.
Development Continues on Ilya’s Patches
Sarathy also found a failure case for Ilya’s Regex Optimization Patch.
Ilya’s replacement of
Dynaloader.pm with his new, much smaller
XSLoader.pm yielded many many warnings in at least one example. Earlier summary of this work
I’m eagerly looking forward to catching up further so I can see what Ilya did next.
A Note About Bug Reports
This item is here primarily because I thought it was amusing.
Someone reported a core-dumping error in Perl and, to comply with the request in
perlbug to supply the minimum subset of code necessary to reproduce the error, enclosed 18 files totalling 2,725 lines.
Note to future users of
perlbug: This is too much. Submissions should be no more than 100 lines and no more than three files; better still is one file with ten lines.
A large collection of bug reports, bug fixes, non-bug reports, questions, and answers. No spam this time, although there was a small amount of well-deserved flamage.
Until next time (probably Friday) I remain, your humble and obedient servant,
Something wrong with this article? Help us out by opening an issue or pull request on GitHub