Links, where Perl is very much alive

Yeah, I guess my weekly links effort didn’t go so well. Nevertheless, I do still collect interesting links, so let’s restart with a less ambitious irregular series of “Links” posts.

Many programmers today consider Perl to be dying. That is because they read too many shiny new Ruby and Javascript blogs, instead of checking out what the Perl community is actually up to. Damian Conway says it way better than I could.

The slogan of the day, of recent years actually, in the Perl world is Modern Perl. Once you’re ready to get started yourself, get brian d foy’s timely new Effective Perl Programming.

And if you miss the good old days of obfuscated Perl, see the nice Hidden features of Perl collection. You will also find some serious, readable and useful tricks.

Andy Wingo: recent developments in Guile

I watched a talk by Andy Wingo recently: recent developments in Guile. GNU Guile is a Scheme implementation, and a library providing an extension language for applications. Guile is actively developed, and promises some exciting stuff in upcoming releases, which is why I took these notes and publish them here–read on.

Andy starts by noting that Guile is different things to different people:

  • A GNU language, with bindings for many components of the GNU system and under LGPL 3.
  • A Scheme implementation, supporting R5RS and part of R6RS, plus other goodies: modules (not the R6RS ones), hygienic macros, the CLOS-like object system Goops with transparent integration with GLib’s gobject, Posix interface, and Unicode support.
  • An extension language for applications, like the Gimp.
  • A part of the GNU system (that we are making, even if we don’t know yet how it will look like).

Andy sees Guile’s perception among developers as its main challenge currently. It’s seen as being slow, although it’s generally faster than Python. But there are also opportunities for its perception: its multilingual vision and support–its next release will support ECMAScript besides Scheme, and Emacs Lisp is coming–, and the GNU brand.

Some technical notes

It uses the Boehm-Weiser garbage collector now, which is fast and reliable.

There are ten committers and monthly releases. This is after the project emerged from a long drought in 2000-2007.

Guile has a VM, and a native compiler is coming. Also: JavaScript support, ELisp coming!

It has really good Emacs integration now with Geiser.

There was also a small remark about licensing. Readline and Guile are not quite license-compatible, which makes using the REPL a pain. This sparked a longish discussion–kinda what you expect from a GNU developers meeting :-)

Spreading the Emacs nature

And now, the meat of the talk: spreading the Emacs nature, to emacsify the GNU system. Yes, that sounds like it!

The upcoming Guile 2.0 (or maybe 2.1?) will have full ELisp support, at the moment about equally fast than Emacs’ own, but it will be much faster. It will also have native compilation for even more performance.

Besides performance, it will have much more to offer:

  • native threads,
  • a clear FFI,
  • modules,
  • other languages, as described above,
  • the Goops object system,
  • lots of library bindings – Emacs-Gnome integration would easily be possible, for instance.

Andy’s plan is to replace Emacs’ Lisp engine with Guile. The rest stays unchanged, existing ELisp code will run as-is. Then no form of coercion should be necessary to get people to start writing their Emacs code in Guile languages. The timeframe is 18-30 months from now–looks like a developer release is not too far off!

Interesting Perl 5 modules

In my journey into Perl this last year or so I’ve naturally done a lot of research on available modules. After all, the huge variety of CPAN is one of Perl’s strongest points. I journaled a few modules that struck me as particularly interesting, so why not merge these notes and links and publish them for others finding their way in the modern Perl world.

PSGI/Plack

Superglue interface between perl web application frameworks and web servers, just like Perl is the duct tape of the internet.

Inspired by Python’s WSGI and Ruby’s Rack, this is the modern way of doing Perl web apps.

PSGI is a specification to decouple web server environments from web application framework code. […] Web application developers (end users) are not supposed to run their web applications directly using the PSGI interface, but instead are encouraged to use frameworks that support PSGI, or use the helper implementations like Plack (more on that later).

A large number of HTTP servers support PSGI, so you’ll find anything from simple embedded solutions to non-blocking, asynchronous ones with Comet support.

Similarly, a large number of web frameworks have been built with support for the PSGI spec, again from the advanced and complex like Catalyst to the simple like Dancer. At first I wanted to show off some cool Perl web frameworks in this post, but there are so many nowadays that would deserve to be mentioned that I’ll just refer you to the PSGI/Plack site and let you pick whatever floats your boat.

AnyEvent

the DBI of event loop programming

AnyEvent lets you write event-based (callback-based) code without limiting you to a certain event loop. The event loop based nature of your module is transparent to the user. A large number of external loops are supported, among them Glib (for GTK/Gnome apps) and Qt.

There’s also POE with a very similar purpose. This post and its comments contain a lot of useful information and opinions to compare the two.

Dist::Zilla

distribution builder; installer not included!

Similar to many other modules, this one helps build distributions for upload to CPAN. However, it does not address installation of the module. Therefore, it can do powerful stuff, as it’s only run by developers and typically runs on a repository. It features a promising git integration module, for instance. Reviews are very favorable.

Data::Traverse

Callback-based depth-first traversal of Perl data structures

Data::Traverse exports a single function, traverse, which takes a BLOCK and a reference to a data structure containing arrays or hashes. […] Data::Traverse performs a depth-first traversal of the structure and calls the code in the BLOCK for each scalar it finds.

Simple and useful.

Email::Stuff

A more casual approach to creating and sending Email:: emails

In a “Why use this?” section – a good idea – the author shows that using this module, you don’t need to know how to structure MIME messages, and the code is very short and clear.


Email::Stuff->to('Simon Cozens<simon@somewhere.jp>')
            ->from('Santa@northpole.org')
            ->text_body("You've been a good boy this year.")
            ->attach_file('choochoo.gif')
            ->send;

Weekly Links #2

Conrad Barski and James Webb: Casting SPELs in Emacs Lisp

Conrad Barski’s awesome Lisp tutorial Casting SPELs is now also available in an Emacs Lisp version, edited by James Webb. Even if Emacs Lisp is certainly not the greatest Lisp dialect, it shouldn’t matter much for a beginner’s tutorial and it sure is nice to be able to evaluate everything right in your editor.

ars technica: Tentacular, tentacular!

Cthulhu plucked a manila folder from somewhere within the non-Euclidean geometry of his manbag and dropped it on my desk with a thud.

A geeky, hilarious choose-your-own-adventure story written by Cthulhu. What else could you want for your Easter weekend.

Weekly Links #1

This is the first post in what might become a weekly installment. Like all IT geeks, I read a serious amount of articles online. A lot is not that impressive, but each week, there’s usually a handful of good ones that I’d like to record for myself as well as share with others. So I’m planning to have a Weekly Links post here. To give it a clear structure and to avoid it becoming tedious, I’m imposing some rules on myself: a maximum of three links a week, with a maximum of three sentences of commentary per link. Enough talk, here we go.

Daniel Tenner: How to nap

http://danieltenner.com/posts/0017-how-to-nap.html

Napping is not the same as sleeping, and 20 minutes of napping can do a lot of good without making you feel groggy.

Scott Berkun: The cult of busy

http://www.scottberkun.com/blog/2010/the-cult-of-busy

Time is the singular measure of life. The person who gets a job done in one hour will seem less busy than the guy who can only do it in five. Being in demand can have good and bad causes. The phrase “I don’t have time for” should never be said.

yield thought: On The Fear of Reading Code

http://coderoom.wordpress.com/2010/03/26/on-the-fear-of-reading-code/

The best analysis I’ve read so far of why programmers don’t want to read others’ code, butwhy you should anyway because it will make you better and your life easier.