Welcome to this week’s Perl 5 porters summary. I’m at OSCON at the moment and it’s been a great conference so far. The highlight as usual has been Damian Conway. This year’s “The Conway Channel” revealed a useful module stealing some great ideas from Perl 6 called Var::Pairs, two new test modules and the long awaited update to Acme::Bleach. The real amazing release at OSCON was Regexp::Debugger. Every Perl programmer should add this to his or her bag of tricks. For example, here are some pull quotes from miyagawa++. The rest of the room was pretty much in the same state:

Yeah, it’s pretty badass.

By the way, if you’re curious about my talk about git and Perl, I’ve posted the slides and list of resources.

OK, onward to this week’s summary. Topics include:

When do named subs bind to their variables?
Due to some questions about how state variables are supposed to bind to lexical subroutines, Father Chrysostomos asked the perl6 list how they should behave. That brought a couple of replies from Damian Conway and Moritz Lenz explaining that they bind when the surrounding block is entered.

Read the thread.
Read a related thread.
And another.

IO::Socket::IP in core?
Paul LeoNerd Evans wrote in (as Gabor noted in last week’s Perl Weekly newsletter) that he’d like more reports from Windows users who use IO::Socket because he doesn’t get any bug reports from them. He also wrote that he’d be making an experimental patch to replace IO::Socket::INET and see how it goes against CPAN.

Read the thread.

[PATCH] Support B::Generate and B::C
There was a request to clarify what open items remained on this patch and there was some push back about not wanting to change things that the patch requestor didn’t understand and there was a gentle reply in that vein from Ricardo Signes, making it our first quote of the week:


> Hence *no-one* should be changing the code unless they understand it. 

Alternately, "I made some changes and it did what I wanted!  I have no idea
why!  Help!  It's here on this branch..."

That's actually often going to be a lot better than "I didn't know why it
worked so I deleted it and gave up."

Also, better than, "I didn't know why it worked, and neither did the guy who
committed it, but we figured it can't hurt, right?"


Read the thread.

[perl #114070] here-docs cause bogus line numbers
Lukas Mai reported a number of bugs in heredoc handling in Perl 5.16.0.

Bug #1
Bug #2
Bug #3

[PATCH] v7 after review: fix usage of OK flags vs. all magic
Chip Salzenberg landed some patches which clean up some flags related to the way Perl handles “magic” flags in its internal representations of data structures. This helped to start another round of discussion about given/when and smartmatching which was a very popular thread this week.

Patch thread
More switch/smartmatch traffic

supporting untarring of extensions
Back in January Nicholas Clark submitted a patch about detecting duplicate directories in the perl core tarball. It was resurrected this week as Jesse Luehrs asked some additional questions about how it might be possible to bootstrap CPAN upstream modules into Perl core as it’s built or unpacked. The idea seems to be that there’d be a “minimal Perl” that could run a toolchain to download, unpack and install CPAN modules. There was a bit of back and forth, trying to clarify what would be possible and what would be difficult.

Read the thread.

make array interface 64-bit safe by using IV instead of I32
Chip Salzenberg submitted a patch using IV instead of I32 type in Perl’s C core that handles arrays.

Read the thread.

Tail recursion optimisation considered possible
Yves posted a message that using the __SUB__ addition in 5.16 it would be possible to do some tail-call optimization in recursive subroutines. Eirik Berg Hanssen pointed out that one can already do tail-call optimizations using goto:


use 5.016;
use warnings;

sub countdown {
    my $count = shift;
    if ($count) {
        say $count;
        sleep 1;
        @_ = ($count-1);
        goto __SUB__
    }
    say "BOOM";
}

countdown(3);

__END__
3
2
1
BOOM

 Nope, wasn't expecting that.  But now I see it, I like it. :) 


No doubt __SUB__ is a very cool extension of Perl, joining __PACKAGE__, __FILE__, and __LINE__. (Read about __SUB__ in perlfunc.)

Read the thread

sorting through perlexperiment.pod
Ricardo Signes (our current fearless leader) posted a message asking about certain things which had been tagged as "experimental" in previous versions of Perl.


About two years ago, brian d foy gave us pod/perlexperiment.pod, which is meant
to list the history and status of experimental features.

We'd like to feel freer to treat experimental features as things that are
really experiments, and that people won't want to rely on too heavily.
Unfortunately, right now, there are a lot of features in perlexperiment that
I don't think we really think of as experimental.  For example:

  * Win32 fork emulation
  * weak references
  * 64 bit support

Now, I don't think these are still "experiments," although I'm open to
arguments that they are.  The problem, though, is that I don't think we've
been very good about marking things as experiments, or making it clear when
they're no longer experimental.

So, I'd like to go through this list and figure out whether anything in there
was already called "not experimental" and which things we should formally
declare "real Perl" in perl5180delta.


Read the thread.

Post filed under p5p weekly.