develooper Front page | perl.perl5.porters | Postings from May 2008

This Week on perl5-porters - 4-10 May 2008

Thread Next
David Landgren
May 15, 2008 14:05
This Week on perl5-porters - 4-10 May 2008
Message ID:
This Week on perl5-porters - 4-10 May 2008

   Today, I was doing some mucking about with class data, generated
   packages, and "Class::ISA", and I started to wail and gnash my teeth.
   I cried, "Why can't I just replace the darn object system?"
   -- Ricardo Signes, a man with a method.

Topics of Interest

fascinating paper: heapsort with n log(n) - 0.9n comparisons

   Last week, Marc Lehmann had tossed out a link to an interesting paper
   he had read on heapsorts, with a new implementation that purported to
   require fewer comparisons.

   This week John P. Lindeman wrote a very thoughtful reply that's worth
   reading in its own right. In essence, one of the fundamental problems
   facing heapsort these days is that it is very cache-unfriendly.

   Quicksort and mergesort tend to process data sequentially, and that
   plays nicely with how caches behave. Heapsort, on the other hand,
   tends to skip around all over the place, and that leaves the cache
   lines cold and unloved. And so John feels that heapsort will be
   unlikely to beat the other algorithms consistently, especially when
   large datasets are processed, which is where the correct use of cache
   comes into play.

     welcome to the real world

Helping 5.8.9

   Nicholas Clark asked for some volunteers to help with the mundane
   pumpking tasks that need doing when a new release goes out the door.
   Such things as checking author/email names, module versioning,
   dual-life synchronisations and making suggestions for

   Yitzchak Scott-Thoennes checked out most of the CPAN/core
   discrepancies. Steffen Müller did the author names.

     out-sourcing pumpkingship

add Porting/

   Jim Cromie started to play around with git, and the more he looked at
   it, the more he liked it. He proposed a script to deal with ignoring
   files not under revision control, but Rafael thought that he had the
   logic completely backwards.

     git down

Adding new keywords

   Simon Wistow, in a flash of inspiration, realised that it would be fun
   to dive into the guts and figure out how to add a new keyword to the
   language, such as "method", which would start out being a simple alias
   for "sub". He was quite surprised at how easy it was, and on which
   side things that can be implemented both inside or outside the core
   should be.

   Jonathan Rockway muttered about "Devel::Declare" and
   "Method::Signatures". Jesse Vincent revealed that Chia-liang Kao and
   Yuval Kogman were working on "Perl6-Declare" that was much more robust
   and flexible than "Method::Signatures".

   Matt S. Trout thought that Jesse's recent work on MAD and Yuval's
   start on "B::Simple" should be a big help in making the perl5 syntax
   more malleable.

     anyone for "with"

TODO Tests

   Bram saw what he thought was a flaw in the infrastructure for dealing
   with TODO tests. Imagine a function that should return 1. Except it
   doesn't, because a bug that no-one understands makes it return 2.

   So we write a TODO test to say "this should return 1". Now imagine
   that the bug was tickled, and now the function returns 3. Currently
   there's no way of detecting that the value, while still incorrect, has
   changed. Some people were dubious about the value of detecting this.

     different kinds of wrong

Documentation bug or brain bug? (or, what \k<name> and $+{name} refer to)

   Sébastien Aperghis-Tramoni had a couple of questions about the new
   5.10 regexp extensions (or rather, the documentation that explains
   their behaviour). After a couple of porters worked the the problems in
   the wording, Aristotle Pagaltzis wrote up a new description, that Yves
   Orton thought was a good description.

Understanding refcounts

   Simon Wistow was looking at "Devel::Gladiator", a module that examines
   memory allocations in arenas (geddit?), and wondered why, given two
   nearly identical snippets, one leaked massively while the other

   Naturally, Dave Mitchell gave a cogent explanation as to why, and
   demonstrated a simpler case in a couple of lines of Perl, no modules

Thoughts about overloading method calls

   Ricardo Signes want to do some exotic things with classes, objects and
   overloading. Aristotle Pagaltzis admitted to having wanted to do as
   much in the past. Ævar Arnfjörð Bjarmason had thought of doing even
   more bizarre things, and I would say more, but alas this paragraph is
   too small for it to fit.

   The thread is well worth reading in its entirety, for a view on the
   current thinking on allowing more flexible syntaxes.

Recursive inheritance detected while looking for method

   Lyle ran into a problem with recursive inheritance and wondered why
   things didn't work in a way that would make it possible.

   Nicholas Clark explained that the code that looks after this was
   heavily rewritten thanks to Brandon Black and his MRO work. He also
   thought that it should be possible to plug in a custom MRO handler
   that would do what Lyle wanted.

"File::Path::mkpath()" incompatibility in perl-5.10

   Gisle Aas demonstrated a problem in the 2.x version of "File::Path"'s
   mkpath creating unwanted directories. David Landgren offered a
   work-around, and began to work a better solution.

     the right path

Should potentially confusing labels emit a warning?

   Following up on Andy Lester's blog about the grief caused by "BEGIN: {
   }", which is a labelled lexical scope rather than a "BEGIN" block,
   there was a tentative suggestion to make such things warn.

   Most people weren't too comfortable with the idea, suggesting that if
   it was really a problem then it would have wound up on the TODO list
   at some point.


Special blocks below the top-level scope

   In playing around with BEGIN blocks while researching things from the
   above thread, Aristotle Pagaltzis came across some some strange
   behaviour with a BEGIN block within a subroutine.

   Nicholas explained how it was quite consistent given the rules
   concerning compile-time and run-time effects, and Jan Dubois wrapped
   out the remaining doubts.

On the almost impossibility to write correct XS modules

   Marc Lehmann had raised the problem of "char *" as an interface to
   character strings in XS last week. Yves Orton pointed out that this is
   used internally by the core, and thus faces the same issues. Win32 is
   particularly sensitive to the issue.

TODO of the week

   chromatic proposed a patch for the TODO from last week. Yay!

     the yada yada yada operator

   and a revised patch to add the "...", "!!!", and "???" operators

     the yada yada yada trinity


   "system()" accepts a LIST syntax (and a PROGRAM LIST syntax) to avoid
   running a shell. "readpipe()" (the function behind "qx//") could be
   similarly extended.

Patches of Interest

Add Some Links to External (WWW) Resources to the Perldocs

   David Landgren thought that the patch to add web page links to the
   Perl documentation should be refused on the grounds of the likelihood
   of them becoming obsolete and therefore contributing to the
   maintenance burden.

     looked at your 1996 bookmarks recently?

I must be *mad*

   Jesse Vincent moved MAD's libraries under lib/ and placed them under
   the "MAD::" namespace. Other than that he tidied up Gerrard Goossen's
   work on the test suite and generally brought the bitrot level down
   close to zero.

   Gerrard wondered whether, because of the dependency on "XML::Parser",
   if it wouldn't be better to spin the libraried out completely as CPAN
   modules. Jesse felt that pulling MAD too far away from the core would
   all but ensure its demise.

     what, me worry?

Documentation typo fix for MRO

   Florian Ragwitz suggested a documentation patch for MRO but it was

     the next self can

Call "SvMAGICAL_off" in "mg_free"

   In the ongoing saga concerning "mg_free" and "mg_clear", Bram
   identified only one other place in the core where "SV*MAGICAL_off()"
   was called after "mg_free". So he cleaned things up, and Rafael
   Garcia-Suarez applied his patch.

   In the process of working with magic, Bram wanted to know how to
   downgrade a "PVMG" to a "PV". John Peacock wondered why on earth
   someone would want to do such a thing, to which Bram replied that it
   would make testing easier. John suggested a different approach that,
   while more work for Bram, better reflected what was going on under the

     got magic?

Add "SvMORTAL" to check if a SV is mortalized

   Claes Jakobsson was grovelling deep in XS code, trying to figure out
   whether SV were mortal or not, and was surprised to discover that
   there was no simple check available. So he wrote a macro to allow SVs
   to be tested as such.

   Rafael wondered whether it would be more interesting to wrap it up as
   a module so that older perls could use it. In turn, Claes wondered if
   the hassle of setting up the module and having the XS author bring it
   in and use it was worth it.

   Nicholas was hesitant to load up the core with yet another addition to
   the API, and when Claes thought about writing regression tests for it,
   he realised that the best place for it would be on CPAN.

     mortal combat

New and old bugs from RT

Bug in "File::Find" on Windows when target dir is bare drive letter and 
"no_chdir = 1" (#41555)

   Last week, Bram fixed this bug, but wondered how one could write some
   tests for it. This week, David Landgren sketched out an approach, but
   no-one commented on its viability.

Ambiguous Configure run/make error (#49946)

   Stefan Schlotterbeck-Macht filed a bug back in January concerning a
   cross-compilation failure, the exact problem being a "make" target
   "<command-line>" not having a rule in the Makefile. Andy Dougherty
   noticed it this week, and suggested that it was quite possible that
   just deleting the target in the "Makefile" would be sufficient.

"NDBM_File" fails to build (#50180)

   Also back in January, Devogon filed a report with "NDBM_File" not
   being built on 5.10.0 under Debian. Andy had a look at things, and saw
   that they had changed both the name of the header file (now called
   gdbm-ndbm.h) and the library file (gdbm-compat).

   Andy wanted to patch Configure to do the right thing and so made a
   request for comments. Currently there are three different header files
   to search, as well as three different library names. The question was
   whether there were any other possibilities lurking about on other

     speak up

Crash when localizing a symtab entry (#52740)

   In April, Niko Tyni wrote a very detailed bug report concerning a
   segfault in a mod_perl environment. This provided sufficient
   information to Rafael Garcia-Suarez to make a small change to sv.c,
   which was later officialised as change #33807.

     one good turn deserves another

perl-5.10.0-33733 assertion with JSON::XS-2.2 (#53244)

   This is the thread about the correct use of "SvCUR". Nicholas Clark
   revived the thread when he explained that one of the reasons the code
   broke was that because when gcc is instructed to add the "-g" compiler
   switch for debugging purposes, Configure piggybacks this and enables a
   raft of code assertions, and "JSON::XS" was tripping over one of them.

   Many new assertions had been added to the code by Nicholas when he
   worked on slimming down the SV bodies, and he needed to be sure that
   nothing broke out in the wild (due to a cavalier approach to the
   internals). Andreas König's long BBC smoke campaign showed that by and
   large Nicolas's changes were completely transparent.

   Marc Lehmann compared 5.8.8 and 5.10.0, running bare, or with POSIX
   loaded, and noticed that while the bare binary was smaller, the size
   when POSIX was loaded showed a larger increase on 5.10 compared to
   5.8. This appeared to contradict the statement in perldelta, and this
   left Marc feeling a bit confused.

Bug in "if(open(my $fh,...)) { }" scoping (#53504)

   Aristotle Pagaltzis showed how Perl 6 deals with the problem of
   scoping lexicals to blocks, and that the rules there are much simpler.

bug with "index()" matching beyond end of string when \0 bytes are 
involved (#53746)

   Giuseppe Insana filed a fairly comprehensive report detailing his
   surprise at some results with "index" when NUL bytes appear in the

   Bram simplified matters, which made it clear to see what the problem
   was. Abigail wrote a series of TODO tests so that some budding
   internals hacker who wanted to take a stab at fixing "pp_index" in
   pp.c would know if their efforts were successful or not.

     hint hint

64-bit Integers -- inexact division gives odd result when is large (#53784)

   Chris Hall ran into difficulties with the results of large integer
   divisions being upgraded to floating point, with the loss of accuracy
   that that implies. He and Dominic Dunlop kicked the problem around a
   bit but were not able to come up with an explanation for what they
   were seeing.

     but -Mbigint ok

No complain about bareword (#53806)

   Ronald Fischer complained thusly when bitten by "print" merrily
   accepting a bareword as its first argument and silently stringifying
   it. Bram promised some TODO tests for this.

   Something tells me this is not going to be simple to fix.

     the magic of print

perlpodspec typo "Encoding::Supported" (#53908)

   Kevin Ryde found an instance of "Encoding::Supported" that he
   suspected should read "Encode::Supported". And indeed it should.
   Patched by H.Merijn Brand.

"pod2man" loses "=head2" starting [with] ' or . (#53910)

   Kevin also discovered that "Pod::Man" failed to properly escape POD
   headings that begin with a quote or period, letting them be
   interpreted by *roff and thus ignored. He proposed a simple patch that
   should be enough to resolve the issue.

     more POD love

Perl5 Bug Summary

New Core Modules

   Encode 2.25
       Released by Dan "the Encode maintainer" Kogai.

   IO::Compress::* 2.010
       Paul Marquess synched blead with the current CPAN release, which
       should make things play more nicely on 5.10

   threads::shared 1.19
       Jerry D. Hedden pushed the latest "threads::shared" out the door.
       The main change is saner semantics for "ref()" on shared objects.

   Thread::Queue 2.07
       The above module in turn allowed Jerry to release a version of
       "Thread::Queue" that allows one to enqueue structures with
       circular references.

In Brief

   Bhavna Yadav wondered how to port a Perl script on Vxworks. Dominic
   Dunlop pointed out that Wind River ported Perl independently to their
   Vxworks operating system... seven years ago, and as far as Dominic was
   aware, no porter had any technical knowledge of the platform.

   Thanks to Reini Urban, one can build a static perl on Cygwin.

     no shared libraries

   Alexandr Ciornii pinged the list with an 18 month old "Net::SMTP"
   documentation patch that had never been applied.

   In the Taint (PL_tainting, SvTAINTED_on, SvTAINTED_off, SvTAINT)
   thread, Paul Fenwick explained that late-acting tainting left
   "PERL5LIB" wide open.

     this is a problem

   Vadim Konovalov cross-posted a question regarding Perl
   cross-compilation on arm-linux but no-one took him up on it.

   Abigail tweaked "File::Copy" to use the 3-arg open instead of a
   slightly crufty and vaguely deprecated 2-arg form.

   Abigail also wrote an initial cut to teach "File::Copy" to respect
   permission bits. This caused problems on Cygwin, so, for want of a
   better solution, Jerry D. Hedden changed some of the failing tests
   into TODO tests for that platform.

   Alexandr Ciornii supplied a "Data::Dumper" patch to make the latest
   blead version compile on older perls.

   Ricardo Signes fixed up a POD link for "perlunitut".

   David Nicol wrote a wafer thin patch to underscore the semantic
   importance of the empty pattern ("//").

Last week's summary

     This Week on perl5-porters - 28 April-3 May 2008

About this summary

   This summary was written by David Landgren.

   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, please consider contributing to the
   Perl Foundation or attending a YAPC to help support the development of

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About