My Frozen Perl 2011 Keynote

I've uploaded the slides for my Frozen Perl 2011 keynote, in which I answer one part of the question "What are five things I hate about Perl?"

You may remember that I first asked that question in the introduction to Mastering Perl, so I've been thinking about this since 2005. I posted it on use.Perl in 2007 and Stackoverflow in 2008 (and Jeff Atwood picked up on for Stackoverflow Podcast #73 (around minute 47), although I'm not sure that. I might have picked it up from 5 things I hate about Ruby, which is about the same time that I would have been writing that for Mastering Perl.

Almost everyone fails this question though (and Jeff's answers are very weak). Most people don't think about it long enough, so they answer with very superficial, stylistic things that don't prevent them from doing anything but that is just their pet peeve.

The Future of Perl Documentation (part 1 of 3)

Perceived Extinction - Some context

Perl is tired, old, crusty, and ready for the farm where its spirit can run free with the likes of COBOL and Fortran.

Or at least that's what some people outside the community say.

We know this couldn't be farther from the truth: Perl 5 is alive, "Modern Perl" is buzzing on everyone's lips, Moose has brought Perl OO into the 21st century, frameworks like Catalyst and Mojolicious tame monstrous web projects, and ORM libraries like DBIx::Class make database interaction fun again!

A widely held view of Perl in the realm of large-scale software development, however, is that the language and community are dying. Despite the obvious absurdity of this to those of us in the Perl trenches every day, the perception of Perl can and will become self-fulfilling. Perception is -- or at least begets -- reality.

The Future of Perl Documentation:

Introducing App::htrepl

I've released a (very preliminary) development release of a new project, App::htrepl, a commandline REPL for more easily debugging HTTP applications. It was inspired by a similar project for Node.js, the link to which I can't find at the moment. You can find the repository at github here, and it will be hitting your local CPAN mirror soon.

REPL means read-eval-print loop. App::htrepl provides a commandline script, htrepl, which makes it easier to talk to your HTTP applications. The only dependencies are LWP and Term::ReadLine; the code is otherwise designed to be as lean as possible.

Here are some examples of how it can be used:

Padre 0.82 has been released

Once again another release of Padre the Perl IDE has been uploaded to pause to hit cpan in due course.

Padre 0.82 comes after a long and interesting look at how we manage our releases.

Padre has nearly always been released directly from trunk, simply because it meant that the process of building the release was kept simple. But it also meant a 'freeze' to commits made to trunk while the release was being put together. While for the most part this was really only a matter of a couple of hours, it meant that translations wouldn't make it into the next version.

To alleviate this, every now and then we'd 'freeze' trunk for a longer period of time, of course the moment you freeze trunk, you stop any developers out there itching to get their changes back to the main repository. This isn't a good thing.

Fisher's Creek Consulting

My consulting business is now at Fisher's Creek Consulting, for anyone that is interested.

Test Driven Development of Excel::Writer::XLSX Part I

For the last few months I have been porting Spreadsheet::WriteExcel to the new Excel 2007+ file format.

The older Excel file format was comprised of sequential binary records whilst the new file format is a collection of XML files in a zip container.

The newer module maintains the same API as Spreadsheet::WriteExcel but is in a different namespace. It is called Excel::Writer::XLSX.

Some of the test driven development aspects of writing Excel::Writer::XLSX have been interesting and I'd thought that I'd blog about them here.

At its simplest an Excel XLSX file contains the following elements:

review: O'Reilly video "McCullough and Berglund on Mastering Git"

This is the first O'Reilly video I downloaded. Technically this course has been recorded in optimal conditions. You won't be disturbed by noise nor bad images. O'Reilly did a great job at mixing the video with full-screen laptop screen and the room.

By downloading the course you'll get more than 5 hours of interesting course. The course is divided in well-organized chunks. Each chunk handles a specific item of git, which makes it great for later review.

http://yapc.eu/ - thanks to all involved

I'd like to publicly thank Bram, the previous owner of http://yapc.eu/.

I asked if we could transfer it over to the Perl NOC team so that it becomes an official community resource (he was already redirecting it to the yapceurope.org domain).

He was more than happy to do so, and has been so helpful in the process.

At the same time I'd like to thank the Perl NOC guys for taking this on. You probably don't realise just how much infrastructure these two guys run on our behalf, and how much more they are taking on!

I'd also like to thank the ACT team who run most of the Perl conferences websites and have setup yapc.eu on their server.

http://yapc.eu/ - points to the http://www.yapceurope.org/ site.

http://yapc.eu/ year will redirect you to the relevant historical sites.

Patching XS modules

Today, I found out about a new release of Image::Thumbnail , which has support for Image::Epeg , a library coming from the Enlightenment desktop manager. Likely, epeg is quite fast, but it didn't build and test right under Windows. Conveniently though, Tokuhiro Matsuno maintains the module on github, so it was just a matter of forking and cloning his repository, and then trying to find out what made it break.

The breakage itself was three parts:

  1. A build failure where the symbols were not exported. It seems the epeg library wants -DBUILDING_DLL , which I supplied as a cc_optimize_flag through Module::Install, because I couldn't find a better way.
  2. Some test failures because binmode() was not used with the test image files. Easily fixed.

These two tests made it into v0.11 , released about 30 minutes after I told tokuhirom about the patches.

  1. The remaining problem was that a function call crashed Perl with

    Free to wrong pool ... at ...

DBIC Deployment Handler

I think, after a load of floundering around, that the way to use DBIx::Class::DeploymentHandler has finally clicked - I have no idea why it seems to have been so hard for my mind to work out how to use it, but this module has really made my head hurt!

So, I am aiming to put together a few blog posts on using Deployment Handler to manage upgrades (and theoretically downgrades, but I have never tried those). I should get something produced around the end of next week (minor issues like stage managing a play in theatre all next week allowing!).

Online compiler/interpreter

codepad is an online compiler/interpreter, and a simple collaboration tool. One can test code and share results. Currently, it supports 13 programming languages including Perl.

Architectural Review Board - Please visit my project!

I've been writing and rewriting Nama[1,2,3] for several years now. It's been my introduction to intermediate concepts in computer science.

Nama is an audio recording, mixing and editing application, using Ecasound[4] as the audio engine.

I'm proud of how it has evolved. At first it was all procedural, driven by a command processor loop. Then I added a Tk-based GUI, my first GUI. I added a text interface with a command grammar based on Parse::RecDescent. I introduced OO to separate the code for two different UIs. Then I added classes for tracks, buses and other entities. I added an event system (actually two), serialization, a help system, tests. I created a build system to automatically generate parts of the grammar, the help system, and to merge various files. The code for audio routing has gone through three different design interations: hardcoding, routing by rules, and now, routing by creating and transforming a graph.

Logginz ur console with Mojolicious

A new Mojolicious plugin has been released, Mojolicious::Plugin::ConsoleLogger.

By default, Mojolicious will send debug messages to a log/[mode].log file; if the log directory does not exist, messages will default to the terminal console.

You can use any of the four logging groups for customized messages:

With Mojolicious::Plugin::ConsoleLogger, you can log these same messages directly to your browser console.

Declare the plugin:

And view all your log messages directly from your browser:

console logger devtools screenshot.png

That's all well and good, but let's take it a step further. You can even see error messages when the template is missing:

template not found browser console error.png

Or when there's a template error:

syntax error template mojo console logger.png

Even when there's a Perl compilation error:

perl error mojo console logger.png

As always, Mojolicious installs in about a minute:
sudo -s 'curl -L cpanmin.us | perl - Mojolicious::Plugin::ConsoleLogger'

Disclaimer:
Implementation stolen from Plack::Middleware::ConsoleLogger

A simple API to access Reddit

I had always wanted to perform some analysis on all the posts that Reddit gets. I searched CPAN for a module that does something similar, and found nothing. So, I decided to write my own. This is still a work in progress, and currently only allows you to fetch and parse the data in XML.

Finance::QuoteDB 0.15 released

Please note that I have released Finance::QuoteDB 0.15 to CPAN.

Finance::QuoteDB is meant as a fullblown database application for
maintaining stock data. It allows anyone to easily create and update a
stock database. The information is gathered by using Finance::Quote
and the database is created and maintained by use of DBIx::Class.

The config-file for GeniusTrader use is generated automatically.
Interface to R is planned to be integrated.

Cascading config parsing

Prompted by some comments about how to handle RAW files from cameras, I revisited App::imagestream , the program I use to automatically publish all images I touch to a gallery page on my website.

An experiment that I run with this program (and with App::fritzgrowl as well) is to specify the configuration information via POD. There is code in Config::Spec::FromPod and Config::Cascade that takes POD and turns it into a hash of hashes containing the configuration model. Then there is more code in App::ImageStream::Config to turn this model into a DSL for a config file, a parser for Getopt::Long or simply the defaults. Config::Cascade then fills out the values, starting with the most specific values coming from the command line, the less specific values coming from the config file and the least specific values coming from the application defaults, all driven by the documentation.

Perl memory management...

Does Perl run out of memory?

Today I got an email from someone saying “I was told by a person who used Perl for computational genomics applications that it was running out of memory, so he switched to C++. What’s your thoughts on running out of memory in Perl?”

Just for posterity here is my reply (please note I’m no expert on this sort of thing and have never had the problem) was…

use types

Now that I have "almost" fixed the remaining compiler bugs, I wanted to use the existing framework to enable the possible speedup by using types, esp. low-level internal types. C-style integers and double scalars are used internally in B::CC instead of full Perl IV's / NV's if declared as such, and thus greatly improves execution speed. Esp. for inlinable arithmetic and comparison blocks.

Only at the end of such a block (and only when really needed) the calculated C vars are written back to the perl pad. So I needed better Opcodes flags to define which ops read or write pads, and more possible optimization hints. Most of these flags should be added to core later, when the time will come to speed up not only the B::CC compiler, but also the internal perl compiler.

But how to declare types?

qr/STRING/msixpodual or qr/STRING/mixuploads ?

I released perl 5.13.10 today. I might write more about that later. But one significant change in it is that Perl now has many more regex flags.

So I wrote a short one-off script to find out what words I cound construct from the flags.

Now it just gives you one word that contains as many of the flags as possible, and gives you the remainder. What would be more interesting would be to detect cases where multiple valid words can be made from the flags. E.g. "mix" and "uploads". It just detected that by accident.

I leave that as an exercise for the reader.

Plack::Middleware::NoMultipleSlashes

Ignited by comments on IRC and in the Israeli Perl Mongers mailing list, I've sat (for 10 minutes), wrote and published a new Plack middleware: Plack::Middleware::NoMultipleSlashes. Let me explain what it is.

Apparently you cannot count (by RFC, even) that the paths http://mysite/ and http://mysite// will lead to the same place. This is very tricky, because it means that the framework you're using (Dancer, right? :) shouldn't clean those multiple slashes for you.

So, I figured "why not let Plack take care of it?". I wrote Plack::Middleware::NoMultipleSlashes (a single line of code, really), that cleans those multiple slashes for you, wherever they are in the path.

To use it with Dancer, just add the following to your config.yml file:

plack_middlewares:
- [ NoMultipleSlashes ]

Done!

Thank you, Plack! :)

BTW, if you still haven't gotten around to reading Franck Cuny's latest post, it's right here (PSGIChrome).

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.