This Week on perl5-porters (26 May / 1 June 2003)

This Week on perl5-porters (26 May / 1 June 2003)

As usual, the weekly summary will try to present a useful or entertaining cross-section of the perl 5 porters' activity. The various topics include C-level I/O, scoping, installation layouts, and some amount of bugs and patches.


Mark-Jason Dominus tried to use IO::Handle::setvbuf(), and his recent 5.8ish perl complained that it wasn't implemented (bug #22339). In fact, PerlIO-enabled perls don't support setvbuf() anymore. This was followed by a small discussion about different methods to do unbuffered I/O at the C level.

$<digit> scoping

Bug #22369 demonstrates an oddity concerning the lexical scoping of $1 (and other variables that depend on regexps.) Basically, when the same scope is entered twice, recursively, and when $1 is set by a successful match inside this scope, the second value obliterates the first one, even after exiting that scope. Rafael explained what happens behind the scenes -- $<digit> values are actually associated to regexps, not to lexical scopes -- and said that this behaviour ought to be better documented.

@INC setup

There was a small but interesting thread on the default setup of the @INC path, why it was designed that way, and how OS vendors implement it. Andy Dougherty summarizes it :

Cygwin and IO layers

Gerrit P. Haase, our Cygwin porter, proposed to make no-CRLF the default for output on Cygwin. It's still possible to to pull it in every time it is needed with the environment setting PERLIO=crlf, or on a per-filehandle basis with open OUT, '>:crlf', 'text.txt'. Sounds like a good idea.

Unicode char classes proposal

Jeff Pinyan posted several mails entitled another attempt at adding unicode regex support to perl, about designing new Unicode-enabled character classes. For example, [\p{AtoZ}&&\P{Vowels}] would be equivalent to [b-df-hj-np-tv-z]. He faced Warnock's dilemma at an unprecedented level.

In Brief

Joe McMahon is cleaning up and documenting the perl debugger. He says that it's about 3000 more lines of POD and comments. And while he's at it, he fixed a few bugs that were on his way. Impressive.

Alexey Tourbin remarks that a2p, when built, is linked against libraries that it doesn't actually use (on linux). Andy Dougherty says it's mostly harmless, at least in the usual cases, and provides a patch that removes from a2p the libraries that are only needed for extensions.

A patch that Dave Mitchell sent some time ago, known by the codename of jumbo closure patch, was applied this week. This is basically a reimplementation of closures in Perl. Apparently it broke something on HP-UX 11 + gcc.

Dave Rolsky volunteered to backport Time::Local to the CPAN.

Best of Bugs

Manoj Kumar reports (bug #22329) that perldoc doesn't support command-line options in the PAGER environment variable.

Enache Adrian fixed bug #22372 : in perl 5.8.0, a format that uses a foreach loop variable is likely to segfault.

Scott A Crosby reports (bug #22371) a way to produce hash keys that will collide and that may severely degrade performance of hash lookup. This can be used against some Perl applications as a denial of service attack. Nobody commented.

Craig Barratt reports (bug #22395) a regular expression, /(.*)[bc]/ that appears to be much slower in perl 5.8.0 than in perl 5.6.x (it's apparently O(N^2), versus O(N) previously). It's not clear why.

About this summary

This summary was brought to you by Rafael Garcia-Suarez. Weekly summaries are available on and via a mailing list, which subscription address is Feedback appreciated.