This Week on p5p 2000/12/24


You can subscribe to an email version of this summary by sending an empty message to

Please send corrections and additions to where YYYYMM is the current year and month.

You'd think this week would be pretty quiet, but we saw the usual 300 or so messages. Don't you all have homes to go to?

5.6.1 Trial is out!

The big news this week is that the long-awaited first trial release of Perl 5.6.1 is out, and available for download from CPAN: get the patch against 5.6.0 from your nearest CPAN here. (Don't forget you'll also need to get the 5.6.0 source as well)

Please test it out thoroughly, run your favourite bugs through it and see if they've been fixed, and above all, tell us if it works or if itdoesn't. Use the perlbug utility to get in touch, and the make ok or make nok Makefile targets to send build success and failure reports.


Both Alan and I have been doing some work with profilers recently, and looking at perl's hotspots. They seem to have been in surprising places; Alan found a lot of time was spent setting up and destroying objects, and also dealing with sigsetjmp; these are all things that Ilya looked at last week, but Alan said he only saw a 6% speedup with Ilya's patches, which was a little less than we were expecting.

Nick suggested a couple of optimizations, including the rearrangement of pp_hot.c. This might cause people to wonder what the whole business about pp_hot.c is, anyway. "PP code" are the functions in perl which implement the interpreter's operations: as a simplification, they're the source code to things like print and +. They're called "PP code" because most of their work consists of Pushing and Popping things on and off the argument stack. The idea behind pp_hot.c is that all the frequently used functionality goes in that one file, which means that the object code can be cached by the processor. At least, that's what we hope will happen. So, we need to check that the functions we have in there actually are the most frequently used operations, which means we need to periodically profile and reorganise it. However, since processor caches vary wildly between machines, it's very hard to do the cache tuning accurately. Read about it.

Solaris and Sockets

Stephen Potter brought up an old bug related to sockets on Solaris, which Alan diagnosed as a change in Solaris' behaviour with respect to restarting interrupted system calls - specifically, the restarting of accept() and connect() after a child signal was caught. While this wasn't a bug in Perl, per se, it raised the question of how to shield the user from this sort of operating system change. Things like POSIX don't specify whether or not system calls should be restarted, so it's all down, essentially, to tradition. To make things worse, when the system call was interrupted, IO::Socket hadn't been catching the error, and carried on working, which created a dead filehandle - this in turn generated "bad filehandle" errors instead of "interrupted system call" errors, masking the true problem. And maybe IO::Socket should restart the interrupted operation as well, since that's usually what people want.

Either way, a fix to IO::Socket is needed, which nobody seems to have come up with yet. If you want to do this, you'll want to read the whole thread.


The two Nicks discovered that Perl is being slowed down by the fact that it calls atol, (which is sometimes strtoul in disguise) and this performs lots of integer division - a computationally expensive process which is quite unnecessary when you're dealing with base-ten integers.

Nicholas Clark suggested that it would be a lot more efficient if Perl implemented strtoul itself as part of the looks_like_number routine, the code called every time Perl wants to convert a string to a number. The only worry was locale-based grouping: the C library sometimes lets you turn "123,456" into 123456. (assuming that commas are your local thousands separator) We would lose this ability by doing the conversion as part of looks_like_number. But Nick Ing-Simmons pointed out that this is a red herring, since Perl won't pass non-digits through to strtoul anyway: $a = "123,456"; print 0+$a will give you 123. The only other dispute was to whether this should be done for Perl 5.7 or Perl 6; we'll see whether or not it gets done - and, of course, how much it helps.

Language-sensitive editors

The section in the Perl FAQ on Perl-aware editors and IDEs has been updated, thanks to a very complete survey by Peter Primmer and others. Here's what it looks like now:

PerlBuilder ( is an integrated development environment for Windows that supports Perl development. PerlDevKit ( is an IDE from ActiveState supporting the ActivePerl. (VisualPerl, a Visual Studio (or Studio.NET, in time) component is currently (late 2000) in beta). The visiPerl+ IDE is available from Help Consulting ( Perl code magic is another IDE ( CodeMagicCD ( is a commercial IDE. The Object System ( is a Perl web applications development IDE.

Perl programs are just plain text, though, so you could download GNU Emacs ( or XEmacs (, or a vi clone such as Elvis (, see also, nvi (, or available from CPAN in src/misc/), or Vile (, or vim ( (win32: (For vi lovers in general:

The following are Win32 multilanguage editor/IDESs that support Perl: Codewright (, MultiEdit (, SlickEdit (

There is also a toyedit Text widget based editor written in Perl that is distributed with the Tk module on CPAN. The ptkdb ( is a Perl/tk based debugger that acts as a development environment of sorts. Perl Composer ( is an IDE for Perl/Tk GUI creation.

In addition to an editor/IDE you might be interested in a more powerful shell environment for Win32. Your options include the Bash from the Cygwin package (, or the Ksh from the MKS Toolkit (, or the Bourne shell of the U/WIN environment (, or the Tcsh (, see also, or the Zsh (, see also MKS and U/WIN are commercial (U/WIN is free for educational and research purposes), Cygwin is covered by the GNU Public License (but that shouldn't matter for Perl use). The Cygwin, MKS, and U/WIN all contain (in addition to the shells) a comprehensive set of standard UNIX toolkit utilities.

Numeric conversion on HPUX

Merijn and Nicholas Clark went through twelve rounds with the HPUX compiler this week; it seems to have won. It all started with some innocent-looking numconvert.t test failures. (Well, all right, nothing about numconvert.t looks innocent, but let's not let that spoil the narrative.)

Then we discovered that the problem was in edge cases: "4294967296" was getting wrapped around to 0 when used as a UV. Nick thought this was a problem with casting, so had Merijn remove Perl's trust in the compiler's casting abilities - this still didn't help. Then Nick thought it was something to do with sv_2nv, but then we found out it was something to do with addition and writing back the value: $a += 0 was giving the wrong answer, but $a+0 was fine.

By now, it's time to go through the usual routine of blaming the optimiser and the compiler, but turning off optimisation didn't help. Nick had a brainwave, and tried testing earlier versions of Perl - all gave the same result, thankfully ruling out his recent UV-preservation code. But when he tried a simple C program to do the same thing, he found that C gets it wrong on FreeBSD x86, but Perl gets it right! Nick's gone away on holiday, but we can expect him to be vigorously scratching his head about this one all the while...


Lots of fun little things happened this week.

Repository browser

I announced the repository browser, at; this allows you to grab files and patches from the repository, look at what patches affect a file, and get a cvs annotate-style blamelog of a file.

Dependency checker

Rocco Caputo's distribution dependency checker is up at - run it in the root of a module distribution, and it'll tell you what dependencies that module has.

Unicode task

Jarkko has a task for someone:

Here's a little something that someone might consider doing over the holiday season, a nice way to get to know UTF-8 if someone feels the urge or interest to do so.

If that's you, see Read about it.

use constant Updates

Casey Tweten has hacked around the constant pragma so that you can now declare multiple constants at once, which is pretty cool, but there's been no word on whether or not this is going in the tree.


The usual contingent of "OK" messages, test results, new bugs, old bugs (thanks to Stephen Potter for dredging up still-active old bugs) and non-bugs. And a few thanks messages - thanks for them!

So, that's all for now; enjoy the holidays, set $|=1 on the appropriate filehandle, and have yourselves a merry little Christmas.

Until next millennium I remain, your humble and obedient servant,

Visit the home of the Perl programming language:

Sponsored by

Monthly Archives

Powered by Movable Type 5.13-en