This Week on perl5-porters (21-27 April 2003)

This Week on perl5-porters (21-27 April 2003)
  This week's summary presents a nice variety of language issues. Read
  about some new errors, documentation patches, bug closing and
  configuration.

Don't assign to %::
  Dave Mitchell proposed to change assignments to %:: to be a compile-time
  error (currently, this may cause crashes, and a non-warned user may fall
  in this trap). Enache Adrian objected that this doesn't prevent all
  nasty things that may be done with the main stash, and thus was
  unnecessary bloat. Arthur Bergman proposes to mark %:: as read-only
  instead. Hugo van der Sanden feels this patch is actually trying to hide
  other problems.

      http://xrl.us/g4o

Use of freed value in iteration
  It's a well-known fact that you can crash perl by modifying an array
  over which a for loop iterates. Dave Mitchell changed this into a new
  fatal run-time error, Use of freed value in iteration.

      http://xrl.us/g4p

Localization of lvalues
  Dave Mitchell (who got bored and was browsing the bug database) reminds
  the crowd that "local($x=3D'bar')" is currently equivalent to "$x=3D'bar'"
  (i.e. the local() is silently ignored). This is not the right thing ; it
  should either produce some error, or localize $x, before or after the
  assignment occurs. The general opinion is to disallow it, purely and
  simply. Rafael, noticing that other lvalues can be localized (e.g. "pos"
  or "substr", although not very reliably sometimes), thinks this should
  be fixed to work. Hugo, however, says that the most we can do is to add
  a deprecation warning.

      http://xrl.us/g4q

Slice auto-extending
  But Dave didn't stop there. He also asked about whether splice() should
  extend the array it operates on (bug #1832). The consensus was to fix
  the docs, which are unclear.

      http://xrl.us/g4r

Restricted hashes strike back
  Jarkko asks for someone to solve the remaining problems about restricted
  hashes -- that replace pseudohashes in the implementation of the
  "fields" pragma in the perls to be released. And this someone will be
  ... Dave Mitchell ! (More precisely, the problem is with list assignment
  to a restricted hash.) Dave sends a patch that modifies the way a
  restricted hash is cleared : all keys are set to placeholders. So you
  can now assign a list to a restricted hash ( %h =3D (key =3D> 1) ).
  However, if this list contains a disallowed key, %h is left empty rather
  than with its original contents.

      http://xrl.us/g4s

Documentation effort
  Casey West announces that he's going to `do something useful for
  documentation', and posts a list of goals. Notably, he's willing to
  coordinate and encourage efforts. Then, proving it, he posted a large
  number of documentation patches, closing a large number of bugs.

      http://xrl.us/g4t

  Meanwhile, Nick Ing-Simmons agrees that the PerlIO / open / binmode /
  perliol docs need to be cleaned up so that they fit more nicely
  together.

Duplicating the DATA filehandle
  Josh Purinton notices (bug #22010) that reading from a dup'ed DATA
  filehandle, by doing open(F,"<&DATA"), in fact doesn't read anything.
  (Further investigation indicates that this only occurs when the
  environment variable PERLIO is set at "stdio".) Nick Ing-Simmons points
  out that when the dup is done, the file pointer of DATA is at EOF, and
  that dup'ing DATA is not going to copy the DATA buffer.

      http://xrl.us/g4u

Lists in scalar context
  Bug #22027 is merely a question, asked by Mike Stok : the value of $x,
  after this statement :

      $x =3D (1,2,3,());

  is undef. Is this the right thing to do, or should the final
  parentheses be ignored, hence setting $x to 3 ? Graham Barr explains
  that "a list in a scalar context evaluates each element in a scalar
  context before any flattening is done."

      http://xrl.us/g4v

sfio
  Nick Ing-Simmons asks whether sfio support can be removed. Andy
  Dougherty and Stas Bekman point out that it's used on some mod_perl
  installations, because under mod_perl STDOUT is tied (unless perl is
  compiled to use the sfio library), and formats don't work with a tied
  STDOUT. Mark Mielke considers that writing a CGI and expecting it to
  work under mod_perl is naive anyway.

      http://xrl.us/g4w

prebind on Mac OS X
  Nathan Torkington asks about the use of the "-prebind" linker option on
  Mac OS X. Dan Kogai tells him to use the update_prebinding command,
  which should optimize the loading of XS modules (and other dynamic
  libraries). Wilfredo S=E1nchez adds that adding "-prebind" to the linker
  flags can't hurt.

      http://xrl.us/g4x

etc.
  Dave Mitchell fixed a case of memory corruption with the "goto &sub"
  construct.

  Abe Timmerman released Test-Smoke v1.17, with loads of improvements.

  Peter Scott produces a mysterious case (filed as bug #21999) where $1 is
  modified by an unsuccessful regex match, inside a for loop.

  Several people walked through the bug database, closing bugs to be
  closed, or proposing fixes for old bugs. Thanks to Robert, Ask, Arthur,
  Dave, Casey, and probably others.

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 perl5-summary-subscribe@perl.org.
  Feedback (and patches) welcome.
0 rgarciasuarez 4/28/2003 8:51:31 PM
On Mon, Apr 28, 2003 at 10:51:31PM +0200, Rafael Garcia-Suarez wrote:
> Localization of lvalues
>   simply. Rafael, noticing that other lvalues can be localized (e.g. "pos"
>   or "substr", although not very reliably sometimes), thinks this should
>   be fixed to work. Hugo, however, says that the most we can do is to add

localizing substr is always bogus, and may be even harmful somehow.

this

$x="xxx"; { local substr($x,1,1) = "y" }

localizes $x - ie. sets it to undef.

But someone may try to find the cause why $x is void elsewhere - and
letting him do so isn't fair :)

So here is my patchlet from then. A warning may be good too, until
localizing that return value will do something useful.

Regards,
Adi

----------------------------------------------------------------
--- /arc/bleadperl/op.c	2003-04-17 00:25:36.000000000 +0300
+++ bleadperl/op.c	2003-04-29 04:11:05.000000000 +0300
@@ -1141,7 +1141,7 @@ Perl_mod(pTHX_ OP *o, I32 type)
 	pad_free(o->op_targ);
 	o->op_targ = pad_alloc(o->op_type, SVs_PADMY);
 	assert(SvTYPE(PAD_SV(o->op_targ)) == SVt_NULL);
-	if (o->op_flags & OPf_KIDS)
+	if (o->op_flags & OPf_KIDS && type)
 	    mod(cBINOPo->op_first->op_sibling, type);
 	break;
 

0 enache 4/29/2003 3:57:08 AM
Reply:

(Thread closed)