Unusual uses for perl

The alternative title for this post would be Best Holiday Ever where I got to show my family some of the parts of Indonesia I visited as a child, and where we got to visit a hotel in a national park in Borneo in which my family has a business interest. In case you think this is a shameless plug, the vast majority of the income generated by the hotel goes back to the local people -- the investors are facilitators, for whom there may be a long term return.

Random Contest & Event Ideas

Regarding my previous post "And suddenly you're hip"....

First of all: Finally accept that there are two Perls now. 5 and 6. Period. The world needs more Perl - here we have it. :) None of the two will go away. That's a good thing.

None of the following is new, but my suggestion would be to do it more in sync and at the same time and as a group to create a more event-style *cough* collective experience *cough* (think GSoC). It might also bring back people who have abadoned Perl but still keep an eye on the community. Considering how people sometimes talk about Perl on reddit or in Hackernews threads I bet some of them just need a little nudge to come back. (Many have never left in their heart.. *sniff* :)

Arxiv.org Peer Review and the Humanities Journal

Traditionally, the humanities journal has relied on Peer Review much like many academic disciplines. I believe firmly that Arxiv.org or something very much like it will replace the humanities journal in the near future, much like it has in the sciences. One of the main objections to this direction in the humanities is “what about peer review?” This is a major sticking point. The other is “will it count on the RAE/whatever management insanity we have to deal with at the moment?” I cannot answer the latter but I will give a vision of a solution for the former.

Making your code testable

On my previous post, Ron Savage has commented on the way he uses File::ShareDir with Moose, to be able to use data files in the author's code directory.

While I probably won't use this method since File::ShareDir specifically has the ability to use @INC (which makes my - and kmx's - solution possible), it does raise a very important note. You must make your code testable.

Some of it is done by separating your code into smaller parts that are easily testable and can easily be overridden. Please refer to the Modern Perl Book, and the Modern Perl blog on learning more on this.

However, sometimes it's not enough. In that case, you'll need to assist your tests a bit, from your application code. Let me give you a small example.

What's new in WebGUI 8.0 #1 - PSGI/Plack

Overview

On September 9, 2009, WebGUI 8 was announced. Since it was the first major API change since WebGUI 7, we started planning WebGUI 8 with high expectations. Over the course of the last 16 months:

And suddenly, you're hip

Addition: I've made a more detailed list of event ideas.

This Perl marketing thing you know.. I'm really thinking about it every day. I've always wondered how those mechanism of "being THE it-language" or "the tool the cool kids use these days" or "success" in terms of "spreading everywhere" really works.

I've started with Linux in 1995 in Germany and I remember for example how the increasing database support on Linux was celebrated ".. and now XY is available under Linux" and how the success of Linux went hand in hand with the raising success of the Internet and the Web of course. Those were fascinating times.

Over the years I've done something else but Perl but then I went back at a point when I felt "Web is cool again" - and then I had to realize that PHP basically took over the Web. Bad. That's abolutely not what I wanted to spend my time on - coding PHP. So of course I had to notice Ruby.

Taco Bell Programming

Taco bell programming


This is a great article on simplicity and Unix. Very relivent to anyone that wants to understand Perl.

Writing For The Wiki

Just about anyone can help out with CPAN Testers. You can be a heavy-weight tester submitting thousands of reports a month, or a casual tester submitting reports for the distributions you install. You can also help promote CPAN Testers on your blog, or join the group on cpan-testers-discuss mailing list (or associated channel on IRC) and help answer questions testers and authors may have.

However, there is a further way you can help, which is a great way for new testers to get an idea for what and how they can contribute, as well as getting to know the whole CPAN Testers eco-system, and that is by updating the CPAN Testers Wiki.

Lucene Does Not Create Parse Trees

Lucene (in the Java and .NET versions, at least) does not create a parse tree when you use Lucene(.Net)?.QueryParser.QueryParser.Parse() to parse your queries. Instead, Lucene rewrites the query into a set of parenthesized terms that are either optional, required, or prohibited -- i.e. AND, OR, and NOT operators are replaced by +, -, or nothing (optional terms have no prefix).

For example: (ampicillin AND mcnc) OR (penicillin AND NOT scnc)
is rewritten into (assuming that the default operator is OR): (+ampcillin +mcnc) (+penicillin -scnc)

(Written up here because I couldn't find anything useful on the InterWeb about Lucene parse trees.)

(If I am wrong about this issue, please tell me.)

Starting to use File::ShareDir

File::ShareDir is a module to allow you to fetch files that were copied during install-time of your distribution/module. Things like templates, images, XMLs or any other data that you need falls under the category of things you might want to have installed.

The installation itself is done by the module distribution toolchain (initially implemented in Module::Install but now available on all, including Dist::Zilla). You can read on how to add a share files in a directory on the respected documentation of you toolchain selection (or Dist::Zilla).

To reach the files after they were installed you need to use File::ShareDir. It has a few functions that fetch files or directories by module or distribution. It's comfortable, it's easy, it's simple.

However, I was reluctant to use it since I've heard about it mainly since I don't know what to do if I want to use the data files without actually installing the module each time.

Mojolicious is Delicious

I've been working on a new website for a charitable business called HarrysButtons.com. I've been using Mojolicious as my web framework. I started off using Catalyst but I thought it was too heavy for my purposes, and the dependencies are killer on windos^h^h^hdows. So some of the pros of this framework are:
  • Perl
  • Templating System
  • Small
  • Few Depenencies
  • Lightweight

The framework doesn't get in the way. It also doesn't shove paradigms down your throat like a lot of other frameworks do.

Hairy blib vs -I 5.6 note to myself

~/Perl/B-C-work
$ /usr/local/bin/perl5.6.2d-nt -Iblib/arch -Iblib/lib -MO=C 
    -e 'use Class::Accessor; print "ok"' | grep DynaLoader::dl_install_xsub
-e syntax OK

vs

~/Perl/B-C-work
$ /usr/local/bin/perl5.6.2d-nt -Mblib -MO=C -e 'use Class::Accessor; print "ok"' | grep DynaLoader::dl_install_xsub
Using /cygdrive/d/data/urbanr/My Documents/Perl/B-C-work/blib
    gv_list[42] = gv_fetchpv("DynaLoader::dl_install_xsub", TRUE, SVt_PV);
    GvCV(gv_list[42]) = (CV*)(newXS("DynaLoader::dl_install_xsub", XS_DynaLoader_dl_install_xsub, (char*)xsfile));
-e syntax OK

What does blib do to fix the old compiler? Note that cwd contains spaces in the path.

The compiler uses something like

CPAN Testers Summary - December 2010 - Obscured By Clouds

December turned out to be a very interesting month. After a lot of tweaks, I updated several parts of the ecosystem from the Generator, which takes the metabase reports and parses them for the cpanstats database, through to the Builder, which builds the files used by the Reports website, to the Uploads mechanism, which monitors the changes in CPAN and new uploads to PAUSE. It has all helped to streamline the process a little, which means the processing from a report submission to appearing on the CPAN Testers Reports website is getting quicker.

Why Module::Build is great

So I'm back to posting, and apparently I'm not the only one.

As much as I'm impressed by the work done by Reini Urban on LLVM and the compiler, I disagree with his last post.

When I started writing CPAN distributions, EU::MM looked to me like something I will never write. Take this Makefile.PL for example, taken from Test::Simple. Compared to many other Makefile.PL files, this is actually clean and straightforward. It still looks like something I would never write. Why would I ever want to?

How Perl helped me with my mythmas presents, part 2

Another gift I prepare for the annual winter gift-giving season [0] is a mixtape [1] containing my favorite songs of the past year. As you might know, I still buy (most) of my music, and I buy it on vinyl. So once I year I haul my second turntable into our office (where my other turntable and mixer lives), set up an impromptu studio, and spend a few hours preparing the mixtape. You can view my past mixtapes here (if you can read German..).

I also create a nice cover and write up some liner notes, maybe fiddle a bit with the raw recording (using audacity) and then burn some CDs. As my mixtape is a continuous stream of ~75 minutes of music, I want to burn the CD without gaps between tracks, i.e. using DAO (Disk At Once). My preferred tool used to be gcdmaster, which lets me load one big 80 minutes wav file, set some track marks and burn the CD.

SmartGit - Finally a Window git client that doesn't suck

I've struggled a bit to start blogging again after the demise of use.perl.org.

I was so used to it's ways, it's foibles, and the mass of historical posts to refer back to that I've struggled a bit to bring myself to post here.

But having finally gotten past one of my biggest barriers, I find myself motivated to try and push a post through to completion (there was something to be said for use.perl's one-shot approach to posting, at least you couldn't procrastinate and abandon the draft once you started one).

And this momentous event?

The arrival of git as a version control system that I can actually take seriously now.

For years I've struggled with the git'erati and their zealotous ways.

First it was "It's awesome, just use Linux".

Then it was "It's fine, just use cygwin" ignoring the fact it clashes with Strawberry.

Later, this because "It's fine, just use msysgit" when most people on Windows don't like command lines and don't want to use them.

Role::Basic tweaks and the future

I wanted to know if people wanted Role::Basic as a stepping stone for Moose or just for roles. The results of my question are in and every person who has commented on this blog or in my Twitter feed has said the same thing: just roles. They know where Moose is if they want it.

That said, I still want to minimize pain if people upgrade to Moose. That leaves me with three issues.

  • Allow people to easily add getter/setter methods (gets around a limitation in Perl's OO)
  • Probably add -alias and -excludes methods to requires
  • Find out why Role::Basic is sometimes failing on 5.6.2

Why Module::Build sucks

I never understood why Module::Build attracted people at all

It is limited, broken and has less features than the good old EU::MM (ExtUtils::MakeMaker).

Limited:
1. dependencies, like the equivalent of make or make clean never works.
It does not check or clean important intermediate dirs and object files.
I always have to do a make realclean, to start testing with a new perl,
or updated xs file.

2. You cannot use a XS as a submodule in your package.
E.g. with Base\XS.xs windows builds will fail. Windows only!
You'll never find that out until someone else will blaim Windows.
It is just a bad Module::Build and ExtUtils::CBuilder design.
It is even not documented.
See https://rt.cpan.org/Public/Bug/Display.html?id=64476

What are your environment settings for Unicode?

How have you set up your environment to work with Unicode? I want to make a cheat sheet for the Perl newbies. There is some information in the googlesphere but it's disperse and unfocused.

I'm working Unicode into the next edition of Learning Perl. The most frustrating part of this for newbies (Perl, Unicode, or otherwise) is getting all the pieces to cooperate. Even if you get it right inside your Perl program, your terminal might not handle Unicode. If your terminal handles it, you might not have the right fonts. And so on and so on.

I know what I've set up for my system and the programs I use, but that's just for the tools I use. What did you have to

TAP

A recent push at work has been to use TAP everywhere that we need to test something. It's great for a variety of reasons.

  • We are finally trying to test as much as possible.
  • All of the myriad pieces of software, written in a variety of languages, can use the same text-based interface.
  • Anyone in the group can look at the output and understand it.
  • The test results can be read by a single process that parses and displays the results in a uniform fashion.

It's very refreshing to hear C++ programmers talking about TAP.

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.