The Perl from Ipanema

Breno de Oliveira will be giving a talk at YAPC::NA 2012 described as:

Tall and tan and young and lovely, the Brazilian Perl communities have grown a lot over the past decade and have a lot to share with other communities worldwide. Sadly, though, most of the time it feels like there are huge barriers between South America and North America/Europe. I hope to change that a bit now :)

In this talk I share a little about the Brazilian Perl communities’ past, present and future, and try to raise some awareness to the things we’re doing around these parts, and how we’re doing it.

Oh, and also invite everyone to visit us for some hacking by the beach, of course :)

[From the YAPC::NA Blog.]

Marpa::XS is now 1.000000

Marpa::XS is now 1.000000. Marpa::XS is the current lead implementation of Marpa, an algorithm that I hope will become standard for those parsing problems which are too complex for regular expressions. Apparently quite a number of people have put the beta to use. Feedback has been positive -- often extremely so.

What is Marpa?

Marpa is a general BNF parser -- it parses anything you can write in BNF, no exceptions. Left-recursion, right-recursion, ambiguity and even infinite ambiguity, you name it, Marpa parses it. If the grammar is of a class in practical use, Marpa parses it in linear time -- O(n).

Looking for Jeff Kim

I'm trying to contact Jeff Kim about his Net::Amazon::EC2 module. I have a repo on github that closes most of the open tickets on RT for this module. I'd very much like to prepare and upload a new distribution to CPAN and close those RT tickets.

Jeff, if you see this please email me: mallen at cpan dot org.

Thanks.

Not a designer? Get involved with the MetaCPAN logo contest anyway!

The MetaCPAN logo contest is now in full swing, thanks in no small part to FLORA for his blood, sweat and tears in organizing it and also to the Enlightened Perl Organization, which fully funded this contest with astonishing speed.

Just to recap, the contest rules are posted at contest.metacpan.org and the entries are being posted at entries.contest.metacpan.org.

Now, you don't need to be a designer to get involved. Here are a couple of ways you can help out:

1) Get the word out. Let your designer friends know there is $400 up for grabs (not to mention eternal glory). If you're active on Twitter, please tweet about it as well. Send an email to your local PerlMongers group etc.

2) Comment on the entries. Because there is no limit on the number of entries per contestant, the logo submission process is allowed to be iterative. Constructive criticism can lead to authors resubmitting tweaked versions of their logos, which can only be good for the contest.

Dancer: Getting to Hello World

R Geoffrey Avery will be giving a talk at YAPC::NA 2012 that he describes as:

When attempting to learn Dancer I ran into the problem that all the documentation started from “Here is a ‘Hello World’ script”.  But that was assuming many things were set up and configured and that just was not true, at least not on my server.

This is a collection of what I learned.

[From the YAPC::NA Blog.]

Tie::Array::CSV is now more efficient on row ops

Not nearly so exciting as my announcement of Zoidberg, but today I announce the release of Tie::Array::CSV version 0.04.

Tie::Array::CSV leverages Tie::File and Text::CSV to allow access to a CSV file as a native Perl 2D array (i.e. array of array references), without having to read the (entire) file into memory.

The major improvement in 0.04 was inspired by a conversation with David Mertens at the WindyCity.pm imformal meeting a couple weeks back. As I was explaining T::A::CSV to the group over a couple beers, David asked if the file is updated at every change. I said proudly that it was, however he noted that this has some drawbacks.

Alternative Dancer Templating Engines

Dancer uses a simple model of interfacing with templating engines (based on Dancer::Template::Abstract) and makes it very easy to add support for new engines. Thanks to this, if you're not happy with the default simple engine or with Template Toolkit, there is now a dozen different alternatives to choose from. Let's take a look at some of them.

Introducing here

I've just published the first release of the here module, a mechanism for safely inserting generated code into a compiling program. this can be used to write macros, cut down on boiler plate, and to implement new declarations, all without ever having to parse any perl source code.

you operate on code as data, as you normally would when metaprogramming. then a call to use here $generated_code; injects that code into the compiling source

sub my_0 {map "my \$$_ = 0", @_} # a simple macro

use here my_0 qw(x y z);

results in perl compiling

my $x = 0; my $y = 0; my $z = 0;

and all of those variables are of course in scope after the use here line.

here on metacpan

an example module using here is here::declare, which provides compile time assignment to lexical variables as well as a shortcut for defining constants.

use here::declare;

use my '@foo' => [1, 2, 3];

results in perl compiling

my @foo; BEGIN {@foo = (1, 2, 3)}

or to define a constant:

use const2 DEBUG => 1;

which results in:

sub DEBUG () {1} our $DEBUG; BEGIN {*DEBUG = \DEBUG}

giving you both the $DEBUG constant scalar, and the DEBUG constant subroutine with one simple declaration.

feedback welcome.

The Perl Foundation Review 2011 - 2012

Karen Pauley will be giving a talk at YAPC::NA 2012 she describes as:

Over the past year The Perl Foundation has continued to work on its goal of advancing Perl and supporting the community. This talk will provide a review of our recent successes and failures, and take a brief look at the plans for the year ahead.

[From the YAPC::NA Blog.]

grep in Perl - filter in Haskell

By using the the grep function in Perl, one can pick elements from a list that match a certain condition. Haskell uses the filter function to do the same work.

How to parse HTML, part 3

When a solution has the same shape as the problem, it is a very good thing, and not just because it looks pretty. In previous posts, I have described Marpa::HTML, a Marpa-based, "Ruby Slippers" approach to parsing liberal and defective HTML. A major advantage of Marpa::HTML is that it looks like the problem it solves.

HTML parsing: the problem

  1. The problem of parsing an HTML document is essentially the problem of finding the hierarchy of its HTML elements. Conceptually, HTML elements are delimited by start and end tags.
  2. The HTML standards specify that certain of the start and end tags can be omitted.
  3. In liberal and defective HTML, any HTML tag might be missing.
  4. In liberal and defective HTML, unknown and spurious tags may be present in the physical input.

HTML parsing: the solution

Writing API clients in Perl and Python

I recently released a couple of API clients for the Ge.tt file sharing service, one in Perl and one in Python. (I am just a fan of the service, not an employee or contractor.) I would judge myself an "intermediate" pythonista mostly due to inexperience.

It's a culture shock coming from a background of CPAN. The old joke is that Perl is just a life support system for CPAN and that is arguably true, but I am here to tell you: you may not appreciate how good Perl hackers have it with respect to CPAN and the culture around documenting, packaging and testing distros once they're on CPAN.

One Quarter Until YAPC::NA 2012

Fire up your smart phones and mark down these dates: June 13-15. You’re going to be in beautiful Madison, WI for YAPC::NA 2012

While you’re at it, send your spouse and email and tell him or her that they are coming with you to YAPC. They can enjoy our amazing Spouse’s Program during the day, and hang out and socialize with us at night. 

While you’re at it, why not go buy your badge today, book a flight, and reserve a hotel room?

[From the YAPC::NA Blog.]

Serving Files with Dancer::Plugin::DirectoryView and Dancer::Plugin::Auth::Htpasswd

A while ago I was converting a simple PHP website to Dancer, and moving it from being deployed on Apache to Starman. There wasn't a lot of code, so rewriting went quickly -- but, the site used a few specific features of Apache, namely directory indexes (courtesy of mod_autoindex) to allow user access to directories/files on the server, and htpasswd files to password-protect some of those directories.

I could just deploy the new Dancer website on Apache and keep using those goodies, but I thought that it would be nice if Dancer itself provided similar features. So, I created two plugins that do just that: Dancer::Plugin::DirectoryView and Dancer::Plugin::Auth::Htpasswd. Let me now show you how to use them.

CPAN, my first time.

It was not that difficult getting my first distribution released on CPAN. But getting rid of the rough edges meant spending time with my favourite search engine and on IRC.

My code is hosted on github and I decided to let Dist::Zilla handle most of the work associated with releasing. Oh and I already had a PAUSE account so I could start right away.

Using Dist::Zilla turned out to be easy. Just install and after following the tutorial for some minutes I took my new distribution for a first spin.

dzil test
to make sure everything works. (Btw. I finally got around to writing tests, something I have avoided for far too long.)
dzil build
so I can have a look at the final result
dzil release
publish the first development release.

Try the new perldoc

I took over maintenance of Pod-Perldoc, and with the help of a lot of people, I'm ready to merge it into the perl sources. There aren't major new features or a change in structure. I applied a lot of patches. Pod-Perldoc-3.15_12 is on CPAN so you can play with it. This next release fixes 15 old RT tickets, some of them major problems but most of them quick fixes that I merely needed to apply. This week is a good time to test it as the perl sources have a contentious code freeze before Perl 5.16.

The biggest change gets rid of pod2man, which perldoc was using before it turned into the Pod::Man module. Now that it's a module, we can just call it directly. I think that mostly works now, but please test it. See if you can read all of perlfunc.

I’m excited to tell you that Larry Wall, the creator of...



I’m excited to tell you that Larry Wall, the creator of Perl, will be joining us at YAPC::NA 2012. We’re going to be doing a number of things with Larry this year, but I want to tell you about the first two. 

As many of you know we’ve replaced the auction with a raffle. Larry is one of the things we’re raffling off! More specifically, we’re raffling “Lunch with Larry”. Who wouldn’t want to have lunch with this guy? When you buy a ticket for the Lunch with Larry raffle you’ll have 9 opportunities to win! We’ll choose 3 people, each of the 3 days, to go have a bite with Larry and talk about whatever you like.

We’re also going to have a little fire-side chat with Larry at the end of the conference. We’re calling this “One On One With The Great One”. It will basically be an open forum for Larry to address the entire crowd, and for you to ask him some of your most pressing questions. 

[From the YAPC::NA Blog.]

What does CATALYST_DEBUG do?

Introduction

I used to think that CATALYST_DEBUG was an all-reaching magical environment variable that somehow affected the ‘Come back Later’ screen as well as what messages were output via $c->log->...().

I’ve educated myself since then but I’ve always thought it would be an interesting exercise explicitly exploring and documenting the various behaviour under different conditions.

The Code

Code for this example can be found in the catalyst_debug branch.

After each change we run ./script/demo_server.pl with various settings and note the results.

Basic Death

What do we see if we have an action that dies?

Edit lib/Controller/Root.pm so that the index() dies (af2a29e):

sub index :Path :Args(0) {
    my ( $self, $c ) = @_;
    die 'Shot through the heart!';
    $c->response->body( $c->welcome_message );
}

Updates to CPAN module reviews

I've updated all of the CPAN module reviews I've done so far. In all of them the performance and coverages tests have been re-run.

Modules for generating passwords
  • Data::Random has a new maintainer, Buddy Burden, who just released 0.06 (and made his first post here.
  • App::Genpass 2.20 has been released: this adds minlength and maxlength parameters.
Looking up the location of an IP address
  • Added Geo::Coder::HostIP, which I'd missed previously. I've put a bug-fixed version on github, and have started the process to get co-maint, so I can release an update to CPAN.
  • A new version of IP::QQwry has been released.
Spelling out numbers in English
  • I've taken over maintenance of Lingua::EN::Numbers, and resolved all outstanding issues.
Parsing User-Agent strings
  • I've taken over maintenance of HTTP::Headers::UserAgent and released a new version which is more clearly marked as deprecated (and also fixed some bugs and improved test-suite coverage.
  • New versions of HTTP::BrowserDetect and Parse::HTTP::UserAgent.

Marpa::XS release candidate now available

I am very happy to announce that the latest release of Marpa::XS is a release candidate for the first full release, Marpa::XS 1.000000. Most user's experience with the previous beta releases seems to have been trouble-free. The one significant issue that was identified was a failure to properly evaluate null symbols under an unusual combination of circumstances. This problem (a one line error in the C rewrite of the parse engine) is fixed in this release. Unusual as the issue is, when it does occur it results in a parse failure, so that I recommend that all users of Marpa::XS upgrade to the latest release.

Marpa::XS is being kept stable. Bug fixes, even of minor and cosmetic bugs, will be made, as will changes that improve maintainability. But no new features will be added. Interface changes will be especially avoided.

What is Marpa?

Marpa is an advance over recursive descent and yacc. I hope the Marpa algorithm will become the standard parser for problems too big for regular expressions.

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.