This Week on perl5-porters (1-7 December 2003)

This Week on perl5-porters (1-7 December 2003)

I like tie could be the summary of this week's summary. But it would be a bit terse, wouldn't it ? Read on for the details.

Tied hashes and scalar context

This was the highest volume topic this week. Rafael pointed out that tied hashes in scalar context always return 0 with perl <= 5.8.2, which is obviously not a good thing ; and with perl 5.9.0 using a hash in scalar context yields a fatal error, which has the benefit of not returning a wrong value, but which is not backwards-compatible and most inconvenient. So he called for action.

Tassilo von Parseval proposed to add a SCALAR() method to tied hashes, to be called when a hash is used in scalar context. When the class the hash is tied to doesn't provide this method, perl could try to make some educated guesses. For example, if the hash is in the middle of an iteration, this means that it isn't empty. Thus perl could return a true value to indicate this. Moreover, if the hash is not iterating, perl could call FIRSTKEY() if it can't find SCALAR(). The base class Tie::StdHash could include a default implementation of SCALAR(). Tassilo provided a patch, which got applied.

Yitzchak Scott-Thoennes spots a minor gotcha though : removing the last element from a hash will leave the iterator set. So, should scalar(%h) reset %h's iterator ? or implement a smarter fall-back strategy ? Tassilo decided to document this fact for now.

Extending the tied scalar interface

Tassilo also proposed to add a SUBSTR method to tied scalars. Dave Mitchell remembered the old problem about new optional tie methods, that they don't play well with inheritance and backwards compatibility. Michael Schwern and Elizabeth Mattijsen suggest to wait for Ponie and its underlying Parrot vtables to clean up the mess.


Stas Bekman is working on a piece of documentation about the CLONE() method; more specifically, on a full-fledged example aimed at CLONE() method authors. While doing so, he remarked a problem with XS functions called from CLONE() methods, on perl 5.8.2 and later : they receive the arguments to threads->new(). This problem is avoided if the XS module defines PERL_NO_GET_CONTEXT.

In Brief

Leon Brocard released the first snapshot of perl 5.005_04-to-be.

A remark of Nick-Ing Simmons about a compilation issue in Tk led to a discussion of advantages of C inline functions vs CPP macros. Macros won.

Arjen Bax reports that localtime() doesn't seem to take into account the timezone under Cygwin with perl 5.8.2. (Bug #24582.)

Matthias Ulrichs manages to produce a Bizarre ARRAY copy error with a small program, running under perl 5.8.2 + threads. (Bug #24589.)

Randal L. Schwartz reports a bug in CGI::Carp : it doesn't seem to ever output a header. Lincoln Stein says it's already fixed in his development copy.

Alberto Manuel Brandão Simões has problems with using DB_File and UTF-8 keys from an UTF-8 source script. Roman Vasicek suggests to use a DBM filter.

Rafael Garcia-Suarez and Arthur Bergman provided some more comments about how and when CHECK and INIT blocks are run, discussing the possibility of adding a new kind of block, START.[]

Tels pre-released Math::BigInt 1.67.

Thomas Klausner anounced the release of Module-CPANTS-Generator 0.010, a framework to test all distributions on CPAN for 'kwalitee'.

About this summary

This summary was written by Rafael Garcia-Suarez. Weekly summaries are published on and posted on a mailing list, which subscription address is Corrections and comments are welcome.