Perl 5 Internals - Part Four

The first three installments of this series covered Perl's core data types: scalars, arrays, and hashes. This final installment will cover something a bit different: the optree. Those of you who are familiar with compiler concepts are no doubt familiar with the notion of an abstract syntax tree (known as an AST for short). The optree is perl's take on the AST: it's something similar to, but not entirely the same as, an AST. Before we begin looking at the optree, I recommend reviewing the “Subroutines” and “Compiled code” sections of perlguts, as well as looking at perlcall. It is by no means required, but it might make digesting this content a little easier.

(More on my blog)

Perl::Critic for the Camel

Tom C. meditated in Perl Monks that he wants Perl::Critic policies to go with the recommendations from Programming Perl, 4th Edition, Chapter 21.

I started it by creating the perl-critic-policy-camel GitHub repo, which is now a bare distribution structure. Now it can accept pull requests. :)

The next step is probably to make a concise list of the recommendations from Chapter 21, and identify which are covered by existing policies.

I'd love to have this as a "camel" theme, like the "cert" theme I wrote about a long time ago.

Mop for Beginners

Here are some comments on the mop-redux regarding situations in which Perl OO (code) is thought to newcomers or to outsiders. Such situations could be explaining code to an non-Perl colleague at work for a holiday substitution or a Perl class in high school.

Pondering the Mop Up

So, I finally got around to reading the introduction that dams put together for p5-mop.  (If you don’t know what that is, it’s the effort to get a MOP, or “Meta-Object Protocol,” into the Perl 5 core.  This would not be adding Moose to Perl 5, but it would be adding something that would make Moose—or any competitors—a lot more feasible, efficient, and user-friendly.) I’ve been following Stevan’s blog posts about the ongoing work, but a lot of times those are more about certain implementation details.  They’re very useful, and very interesting, and I hope he continues to do them, but sometimes they can be a bit forest-for-the-trees, if you see what I mean.  I think it was great of dams to give us a 6,000 foot view, as it were.

Final Schedule for Ecommerce Innovation Conference

Here is the final schedule for our Ecommerce Innovation Conference at Hancock, NY, starting next Tuesday:

Schedule

Comma quibbling in Perl

Sinan posted his answer to a Eric Lippert's comma quibbling exercise. There are a couple of Perl solutions in Rosetta Code.

Eric says:

I am particularly interested in solutions which make the semantics of the code very clear to the code maintainer.

Sinan's answer works. He handles the cases where the array reference has zero, one, and and more than one elements. In his solution for more than one element, he uses a special case where an array slice will return zero elements when the "high" number of the range is less than the "low" number and the special case where a join with one list item returns only that item. The collapses two cases of the problem into one:

The proposal of separating method keyword from mop

method keyword is the syntax to write method simply.

  method clear {
    # You can omit "my $self = shift" by method keyword
    $self->x;
  }

And method keyword give Perl ability to know it is subroutine or method.

I think that method keyword isn't part of Meta Object Protocol even if mop use it as the part of module features. method keyword is independent feature.

If so, we can implement method keyword before mop release. Big jump is hard, small jump is good. If method keyword can work independent feature, I think it is good that method keyword is implemented into Perl core before mop release.

And user which don't use mop can get the benefit of method keyword. And anonymouse method can be implemented.

  my $method = method { ... };

Compare projects p2, gperl, MoarVM

Screen Shot 2013-10-02 at 12.59.00 AM.png

created by

Planet Moose - September 2013

Welcome to the second edition of Planet Moose, a brief write up on what's been happening in the world of Moose this month, for the benefit of those of you who don't have their eyes permanently glued to the #moose IRC channel, or the MetaCPAN recent uploads page.

Thanks for contributions from Damien Krotkine and Stevan Little. If you'd like to contribute some news for next month's issue, you can do so on the wiki.

Articles about Dist::Zilla

The web site of Dist::Zilla now has a page listing articles about Dist::Zilla.

Having this collection is useful for developers who would like to understand Dist::Zilla more.

In case you know about any other articles, please send a pull request for the dzil.org repository.
The specific file is
articles.pod. (For some reason Github only shows the title, but if you click on edit it allows you to edit the whole file.) Entries are listed by their date.

I translated "Debugger Manual" to English

I translated "Debugger Manual" to English

Debugger Manual

Perl Debugger is very useful tool. but I think yet many people don't know the way to use Perl debugger well. If you can use debugger well, Speed of development increase and decrease bugs. Let's use debugger more!

Introducing Devel::Nopeep, Devel::GDB::Breakpoint, and Devel::GDB::Parser::Breakpoint

I've created 3 new modules to help me out when working on the Perl core; I'm sharing them in the event others find them useful.

They are:

Devel::Nopeep

This module disables the peephole optimiser so that you can see what the op tree would look like before it works its magic (and benchmark the differences, if you like).

For example:

Pinto Road Show: Silicon Valley

The road show continues! This time, I will be presenting Pinto at the Silicon Valley Perl Mongers meetup this Thursday, October 3. So come out and learn how a private CPAN made with Pinto can save you from hours of needless debugging AND make you more productive with Perl. Full details at the Meetup link below:

http://www.meetup.com/SVPerl/events/100029662

From the Stratopan blog

Licenses and the repository links on CPAN

Today I checked the 1,000 most recently uploaded modules again:

DateHas licenseHas repository link
December 201282.6%49.6%
February 201383.4%49.7%
July 201387%60.1%
September 201385%68%

Checking the 5,000 most recent uploaded modules:

DateHas licenseHas repository link
September 201380%58.3%


Check the previous report for information how to create a list of your modules and how to add the license and the VCS information to the modules.

cocktails_for_programmers

cocktails_for_programmers :

No matter what your language, here’s a cocktail for every type of programmer.

[From my blog.]

Object orientation tutorial

I translated Object orientation tutorial.

Perl Object-orientation tutorial

You can learn object orientation basic, "Inheritance", "Encapsulation", "Polymorphism". I use Object::Simple module to describe object orientation. This is Mojo::Base porting to single module.

Docs For Modules In Your Pinto Repository

A couple weeks ago, Andy Gorman sent a patch for a new Pinto command that displays the perldoc for any module in the repository. I thought this was a great idea, but we weren't quite sure about the design. So for now, it is available on CPAN in a separate distribution called Pinto-Action-Doc. Once the kinks have been worked out, I hope to have something like this in the Pinto core.

Andy's work is actually the first plugin for Pinto, and I'm very excited about that. Pinto was designed for extension, so you can create new commands just by writing two modules (one for the back-end implementation, and one for the command-line interface). The Pinto API isn't well documented yet, but I've been told that the code is very clean and the existing commands are easy to follow.

As time goes on, I hope to see a lot more plugins like this one. Kudos to Andy for blazing the trail.

From the Stratopan blog

Games

Alex posted a nice overview of Tk games in perl, along SDL games.

I found out I never published my game UI, a pretty fast Sudoku solver in native Win32.

more thoughts on GCL

After the first burst of rants ähem layout of my cody GUI DSL I call in lack for a catchy bling name : GCL there are still some important holes to fill. Because the issue is not only to save you from boilerplate, but also saving you from mistakes and bad quality layout.

Moscow.pm's new leader

The Moscow.pm group has a new leader. Since now this role is occupied by Pavel Scherbinin (Dzirtik).

Pavel on Twitter
On Foursquare
On YAPC sites

For a few months Pavel has been organising Moscow.pm technical meetings in the office of mail.ru, the company in Moscow he works in. They managed to have two or three talks for every meeting. I think it was a good proof that Pavel was a good candidate for this position and he would bring a new wave to Moscow's Perl life.


I took the leadership in 2007 and was behind a number of Moscow.pm offline meetings, a big enough number of workshops, conferences and hackathons in several countries. Since 2007 our mailing list became de-facto the ExUSSR Perl mailing list. There were a few monger groups appeared in Russia after Moscow.pm relaunch in 2007. As I am no longer living (but not forever) in Moscow and cannot take part in most of its activities, I think we made a good change :-)

I wish the new leader all the best and would like to see newcomers to Perl who will like the language because of Moscow.pm members' work.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.