This Week on perl5-porters - 21-27 November 2005

This Week on perl5-porters - 21-27 November 2005

A quiet week with a bit of action at many corners of Perl development, including some shiny new ones like Lamp. Improvement to docs and threads on Switch, Module::Build modules are among the discussion themes.

No Brute Force Anymore

The last summary mentioned bug #37710 about a failed require succeeding in a second time. Rafael Garcia-Suarez pointed this is fixed in bleadperl and Yitzchak Scott-Thoennes noticed the bug goes back to 5.6.1 through current maint. Rick Delaney entered the discussion to say the fix never made into maint because of the introduction of the new semantic that an undef value for an entry in %INC means the module failed to compile. Rick mumbled on the unfortunate passing of the corresponding change to L<perlfunc/require> which actually shows implementation details in blead but not in 5.8.


Andreas Koenig opened RT ticket #37713 to warn about, which fails miserably with modules like POSIX, version, and others. Even when no opcode restriction is made, examples like the one below fails with blead and even worse with 5.8.7.

    perl -le '
     use Safe;
     use Opcode;
     my $comp = Safe->new;
     my $opset = Opcode::full_opset;
     $comp->reval("use version; \$VERSION = qv(q{1.0.3}); print \$VERSION");
     print $@ if $@;
    Undefined subroutine &version::qv called at (eval 2) line 1.

Yves Orton remembered Tim Bunce declared to be a failed experiment and wondered which is the current status of the module now that Raphael owns it. Rafael answered he continues to fix things, backport the changes to CPAN and thought this issue should be fixed.

Linked List of Arenas

Jim Cromie came back this week to polish its previous RFC patch based on Nicholas Clark's feedback. Jim concentrated on the idea of having arena-size per sv-type and included comments/docs for posterity, say, posterior maintenance. Later, Nicholas Clark pointed some confusion in the patch and kept waiting for Jim's answers.

Pod::Perldoc and Localized Docs

Enrico Sorcinelli, one of the authors of POD2::IT, a project to translate Perl man pages into Italian, proposed again a patch against Pod::Perldoc to support viewing translated pods. Rafael Garcia-Suarez applied to bleadperl the patch. Enrico noticed POD2::FR just started, Portuguese fellows announced POD2::PT shortly, and there is also a little POD2::LT for Lithuanian. This may become a trend.

Documentation Conventions

Sébastien Aperghis-Tramoni triggered a discussion asking about the convenience of a patch to POD files setting up a consistent pattern in the formatting of functions, modules, variables, and others. Andy Lester suggested Sébastien to have a go, see the reaction and go from there. Rafael Garcia-Suarez and others remembered it could be a good idea taking into account the differences in rendering in POD formatters, since pod2text (via perldoc), pod2html to the custom formatters in sites like and After a suggestion by David Landgren, Sébastien's patch which touched perlstyle.pod adopted the use of F<> for files, C<> for generally anything that can be considered part of code and B<> for command names. I think it basically sums up to being simple as POD already is, which doesn't preclude POD formatters to be clever and improved. The patch was applied after a few minor fixes.

concat Misbehavior with Magic

Michele Dondi opened ticket #37722 to report how weird can be the interaction of concat and magic in tie()d variables. Robin Houston summed it up to the bit of code

      sub TIESCALAR { bless {} }
      sub FETCH { shift()->{i} ++ }
      tie $h, "main";
      print $h.$h;

which may output "00" rather than "01" and posted a patch. Rafael Garcia-Suarez noticed the patch broke the warning test case

    $ ./perl -we '$x.=$x'

which should report a use of uninitialized value error. On the grounds of a comment by Dave Mitchell on Michele's finding, Rafael conceded the behavior was not really a bug but the undefined result of execution order in expressions involving side-effects. Robin Houston insisted it could not be that difficult to fix, and tweaked the patch that now provides a left-to-right order on evaluation of subexpressions. The change has been applied as #26192.

    Michele's finding
    Robin's approach

Perl on Lamp

Joshua Juran started a thread by posting some test results from the starting Lamp port for perl 5.6.1. Nicholas Clark curiously asked what led Joshua to elect 5.6.1 as a departing point rather than 5.6.2 or even better 5.8.something. Joshua explained he started working from Chris Nandor's MacPerl codebase, which is at 5.6.1 and promised to leave 5.6 behind as soon as he gets tests passing, approaching 5.8.x or blead. Rafael Garcia-Suarez suggested that, by starting at 5.6.2, Joshua's changes could be incorporated in this or in MacPerl branch. Joshua pointed that Lamp, a project for a Mac-hosted unix-like environment is similar in spirit to Cygwin and will hopefully have more in common with standard Perl than with MacPerl.

    Joshua's test results
    The Lamp project URL

Win32 Lean and Mean

Jan Dubois appreciated the analysis by Thomas Kratz (in ticket #37708) about issues with socket-related declarations on Win32 whether winsock2.h or winsock.h is included. The problem being that Perl compiles using winsock2.h but perl.h includes winsock.h leading to wrong winsock 1.1 constants and errors due to redefined structs. Jan considered the best way to do it, avoiding the breakage of existing modules, which may not need to know about this and neither want it. H.Merijn Brand applied Jan's patch as change #26189.

Module::Build Issues on Win32

A long thread started with a RT report on problems building PathTools on Win2K which was forwarded by Ken Williams to the list. Yves Orton spotted that it was a Module::Build thing, related to the fact that you can't unlink a DLL that is loaded into the memory. ExtUtils::MakeMaker works around the issue because it does the install via make so it doesn't need to load anything that it might be installing over. Yves suggested Module::Build on Win32 should produce a Build.bat rather than a Build perl script, which would allow a more Unixy behavior. Yves, Ken and Randy Sims discussed some issues involving what should force the user to rerun Build.PL and, while on this, Randy produced a patch to ExtUtils::CBuilder to fix an encountered issue. The original case was made to work and more permanent solutions to Module::Build on Win32 should be near (besides the recommendation to use another OS).

Fast Unicode with SWASHGET in XS

This week, Sadahiro Tomoyuki thought it would be a good idea to speedup the retrieval of Unicode properties and transliterations mappings, which was done by the pure perl method SWASHGET. He rewrote SWASHGET in XS, which was welcome and commented by Dave Mitchell, Tels and Steve Peters. By the end of the week, an improved patch was already commited to blead.

Bad Switch Boy

Offer Kaye opened a can of worms when he did the simple question of whether the bug #5607 in Switch had any chance to be fixed. Ronald J. Kimball explained how the issue of an unbalanced "/" causing a fatal error under use Switch is due to the source filter nature of the module and the small probability of a fix due to technical constraints. David Landgren pointed Damian's module was always meant to be an experiment and not for production purposes. There ensued some discussion about the unpredictibility of source-filtered modules, the requirements for a module to enter the core and the possibilities of doing the opposite, removing a module from core. Ah, and there were some advertisement on the DOR operator.

Upgrade to PathTools 3.14 in maint

Ken Williams reflected with Nicholas Clark about the alternatives to merge PathTools 3.14 to maint, after the change that fixed absrel($x, $x) to return curdir() and which is backwards incompatible from the point of view of who risked to depend on this buggy behavior.

Pipes + Threads Broken in blead on VMS

Craig Berry wrote to say how the simplest command line piping in a threaded build of bleadperl on VMS now emits errors:

    $ perl  -e "print 'ok';" | exit
    panic: free from wrong pool.
    panic: free from wrong pool during global destruction.
    %C-F-EBADF, bad file number

On VMS, command-line piping is implemented by Perl itself, and such pipe is opened before any thread context has been initialized. The problem is a check to yelp when deallocating from a different thread than the one which did the allocation and the no context case actually falls into this trap. To Rafael Garcia-Suarez, it looks like this check should be bypassed, which can help also applications that embed a perl interpreter.

Switch in the Core

Robin Houston started an effort to implement the switch construct in core (in manner which is as-compatible-as-possible with by Damian Conway) and called for feedback on his initial proposal, with replies by Rafael Garcia-Suarez, Dave Mitchel, Nicholas Clark and Damian Conway.

Perl5 Bug Summary

This week started with the count of 1517 open RT tickets.

    Robert Spier and the Bug summary
    Perl RT just now

In Brief

valgrind finding from blead Following on Steve Peters trying to guess the source of the leak in a sympathetic bit of code Jarkko Hietaniemi posted, Jarkko delved into the gory combination that was causing the problem: His latest conclusions point to problems with the approach of determining whether $`, $&, $' were found , the corresponding PL_sawampersand and the eluding problem of how we can foresee what eval is going to do to us. With a bit more of investigation, Jarkko is yet not convinced he really found the guilty part.

Fighting Compilers Again Steve Hay reported how change #26152 ("All that can be in the first switch statement ofsv_upgrade is now") broke the windows build using VC++ 6. Steve and Nicholas Clark worked out a fixing change (concerning the use of unary minus to unsigned types), which, despite Nicholas' hopes, produces no errors but a bunch of warnings in VC++ 6, 7 and Borland.

Thread Failures due to Interleaved Output H.Merijn Brand got fixed a problem causing thread failures on AIX (and others) caused by interleaved output.

libnet 1.19 on HP-UX on Perl 5.6.0 Yves Orton reported how he has met with core dumps while building libnet 1.19 on HP-UX on Perl 5.6.0 and asked for any recommendations. H.Merijn Brand brought some clues and made a lot of questions to help diagnosing the problem, which basically pointed to the non-root status of Yves, missing installed patches, and issues with trusted HP-UX systems, the beginning of perl 5.6 and outdated software.

    Yves Orton's woes
    Recent perl builds for HP-UX can be found here

GDBM_file realloc failures On a threads-enabled perl, Rafael Garcia-Suarez noticed the tests ext/GDBM_File/t/gdbm.t and lib/Memoize/t/tie_gdbm.t were failing with the message:

    panic: realloc from wrong pool

Rafael proposed a patch which reconciled the trouble due to memory alloc'd by libgdbm and realloc'd by perl. It was applied as change #26193 to bleadperl.

Where is Perl_do_open? Stas Bekman noticed blead @ 26185 broke mod_perl2 after a problem to find out Perl_do_open function. Rafael Garcia-Suarez explained Perl_do_open now lives in mathoms.c and the do_open macro in perl.h is the way to go. Stas' issues revealed a bug in that Perl_do_open should be visible anyway unless -DNO_MATHOMS were used. Stas did it by dropping the Perl_ prefix on do_open/do_close.

Can't reset %ENV on VMS John Malmberg noticed t/op/array.t and t/op/pat.t failed on VMS because the test scripts call reset 'X', and perl can not reset %ENV hash values on VMS.

Trouble with for (reverse @array) Chris Duryee opened RT ticket #37725 to tell about a segfault on a script using a for (reverse @array) construction. Dave Mitchell found the bug to be due to an optimization error to handle this very construction and fixed the problem. After this, the one-liner

    perl -e '$a[3] = 1; $i = 3; for my $x (reverse @a) { $x = $i-- }; print "@a"'

prints "0 1 2 3" instead of "1 0".

Sort subs can now be recursive Robin Houston fixed perlfunc.pod raising the limitation that sort subs may not be recursive, thanks to the sort/multicall patch worked out in the last weeks.

Version Check Failures due to locale In ticket #37714, "dakkar" showed how version checks can made to fail when a locale is in effect due to conversions of float to strings. John Peacock explained how it is happening in maint and blead and will do some research to make version comparisons independent of locales.

VMS Issues with __FILE__ assuming UNIX Pathnames John E. Malmberg pointed ext/List/Util/t/p_tainted.t assumes __FILE__ returns a Unix pathname, which called for a fix on VMS. On John's question about where __FILE__ is set, Rafael Garcia-Suarez disclosed the relevant points in code. There remained some uncertainty about the adequacy of John's fix, which should be hammered by the discussion among Rafael, John and Craig A. Berry.

Tk Compatibility Gisle Aas pointed how Tk programs segfault when tried with blead and wondered when it happened. Gisle also reminded of changes needed to be applied for compiling and running Tk in the perl-5.8.x branch.

perlce Touches Vadim Konovalov keeps on with the work on the WinCE port of Perl. This time, his patch touches some compilation bits and update explanations, renaming ./wince/README.perlce to ./README.ce.

perlpod.pod and =encoding Yves Orton noticed perlpod.pod omits the new =encoding directive from its "currently supported directive list" and made it right.

Fast IS_UTF8_CHAR() for EBCDIC A couple of weeks ago, it was noticed EBCDIC platforms UTF8 handling was broken, which Sadahiro Tomoyuki promptly fixed - the guilty part was found to be on a change to speedup IS_UTF8_CHAR. This week, Jarkko Hietaniemi tried to redeem himself with a patch to bring the IS_UTF8_CHAR() speedup to (UTF-)EBCDIC platforms and called for feedback from people which have access to EBCDIC platforms.

char (un)signedness in Tru64 Jarkko Hietaniemi grew bored of the wrong guesses of Configure in Tru64 about the stdio char signedness, showed how funky Tru64 can be and implemented a workaround.

Cygwin Wrong Pools Yitzchak Scott-Thoennes found in cygwin/cygwin.c the bug which caused messages like the one below in Cygwin builds and fixed it.

    panic: free from wrong pool at lib/lib_pm.PL line 6.

About this summary

Where's the summary?, you may have asked, or worse you didn't even missed it. "What happened to professionalism? What about deadlines? I've had a cold. The cats ate my homework." And before you say I stole Piers Cawley's line, I just borrowed him the cats. Anyway, here's another better-late-than-never summary brought to you by Adriano Ferreira.

Information concerning bugs referenced in this summary (as #nnnnn) may be viewed at

Information concerning patches to maint or blead referenced in this summary (as #nnnnn) may be viewed at

Weekly summaries are published on and posted on a mailing list, (subscription: The archive is at Corrections and comments are welcome.

If you found this summary useful or enjoyable, please consider contributing to the Perl Foundation to help support the development of Perl.