Under the covers of perldoc

Sometime last year I had to go find out what happens under the covers when a user types a command like "perldoc strict." Here's the trace of which commands call which other commands. It's all in good fun.

I'd used strace to get a process-by-process trace of what happened to just the execve and clone syscalls.

strace -e trace=clone,execve -ff perldoc strict

And the eventual picture resolved:

The Marketing Of Perl

During YAPC::NA, we held a BOF to discuss the future plans for marketing both Perl and TPF. While part of our goal is to promote TPF and the services that it provides, our main goal is to promote the language and the community. There are a few easy ways that we can start creating some of the "buzz" that we've lost over the years. Our current goal is let people know that Perl is alive and thriving (check out Chris Hardie's lightning talk from YAPC::NA).

What are the easiest ways that we can spread the word of modern Perl and eliminate the misguided preconceptions and stereo types that have grown over the years?

Growl from command line

I am a Mac OS X user, and I like Growl. To see notifications can be irritating, sometimes. Irritating and distracting. But this doesn’t mean the tool is not useful.

And I find it useful when processing large quantities of data, and when this process is split in different small processes. In these cases, I like to have Growl warning me about what stage of the process is starting/ending and, when it finishes, to have a final warn about it.

While I can use Growl directly from Perl, that doesn’t work easily when using makefiles, for instance. Then, I wrote a small script that I put into my user binaries folder, and that reads the message from the command line, just like:

 growl Hello World!

In case someone finds this code useful, here it is:

#!/usr/bin/perl
use Mac::Growl ':all';
RegisterNotifications("Command Line", ["Note"], ["Note"]);
PostNotification("Command Line", "Note", "Note", join(" ", @ARGV));

Using App::cpanminus and PerlGcc to Install CPAN Modules on Solaris 10

If you have had the [dis]pleasure of deploying perl applications on Solaris, you probably have scores of tricks up your sleeve for installing pesky Perl modules. I find it necessary that application installations be scripted so I try to avoid anything that requires manual intervention.

Some modules on the CPAN will only install if you use gcc. Building CPAN Perl modules on Solaris 10 tells you how to use perlgcc to accomplish this. Pretty neat. I, admittedly, didn't know about perlgcc until today. It sure would have saved me a lot of headache over the years. I don't know how well it covers edge cases, and I'm sure there are pitfalls.

Let's take this a step further and see if we can get the perlgcc technique to work with cpanminus.

Spot the error

use Data::Rmap qw(:all);
use JSON;
use Data::Dump;
use Clone;
use boolean;

my $arg = from_json(q{{"1":true,"2":false}});
# convert JSON booleans to boolean's booleans
rmap_all { bless $_,"boolean" if ref($_) =~ /^JSON::(XS|PP)::Boolean$/ }, $arg;
dd $arg;

Hint: it's one character long.

In fact, this piece of code is full of Perl's traps (from Perl's lack of booleans obviously, to less obviously having to clone and rmap not working), it disgusts me.

Parsing Perl 3: Perl and Minimalism

One ring to rule them all, one ring to find them,
One ring to bring them all and in the darkness bind them.

One Idea to Rule Them All

Ever since the 50's, the fashion in language design has been minimalism. Languages were designed around paradigms, and paradigms were judged on elegance. If your choice of paradigm was lists, the result was LISP. If you decided on strings, you invented SNOBOL. Arrays, you wound up with APL. If your reasoning led you to logic, you ended up with Prolog. If you thought that descriptions of algorithms must be the basis of programming, then your fate was Algol.

Super easy editable html pages.

As part of an ongoing project to improve the woeful state of Qualitative data analysis software, I've already put together some tools to meet my needs. The tools are very much at the prototype stage, and will remain so for the foreseeable future, but I'm using them to prepare publishable work.

For the data management end of things I use a super-simple SGML format to tag chunks of text that I'm interested in, and use my Text::TranscriptMiner library to retrieve data. I use Git for version control, as a kind of high granularity lab book. I also have a web application which deals with the data visualisation side of things.

I'm looking for issues of The Perl Journal

If you have some hard-copy issues of The Perl Journal (Jon Orwant's magazine), I'd like to trade you something for them, whether that's money or something else. I'd especially like to take a complete set off someone's hands. Send me some email if you have some you want to get rid of.

Bricolage CMS hacking made easy!

After my last post about Installing Bricolage 2 on Mac OS X 10.6 "Snow Leopard," I realized that there are a few more important steps that should be documented for those that was to hack on Bricolage CMS vs. just running it. The following instructions link up your git clone with the application itself, making it easy to apply changes, test them, and push them upstream.

Announcing CPAN Testers 2.0

After 6 months of development work, following 2 years worth of design and preparation, CPAN Testers 2.0 is finally live.

With the rapid growth in CPAN Testers environments and testers over the past few years, the previous method of posting reports to a mailing list had reached a point where the scalability was no longer viable. This was recognised several years ago and discussions for a new system had already begun, with the view that reports should be submitted via HTTP.

At the Oslo QA Hackathon in 2008, David Golden and Ricardo Signes devised the Metabase, with the design work continuing at the Birmingham QA Hackathon in 2009, where David and Ricardo were able to bring others into the thought process to work through potential issues and begin initial coding. A number of releases to CPAN and Github followed, with more people taking an interest in the project.

Memcached to the rescue

Everyday the Internet becomes faster, and everyday new and more complex content is provided via web applications. The problem is that sometimes (maybe most of the times) these rich and complex content applications aren't fast enough to answer big flows of requests. One trick that is often used to improve throughput of slow applications is caching. Instead of always processing requests, that often require some data from one or more external sources, a possible solution is to cache the entire output to answer upcoming requests, or cache smaller components that can be used together to produce the final output.

Memcached is one of the most famous cache engines on the web. It can be used to cache any arbitrary pair key/value, later on in the process you need to know the key to retrieve the stored value. This is one possible caching solution easily to use in Perl. To start using Memcached you can use the following module for example:

hacking bread

no my next ubercool software project isn't called bread, i mean real bread. the bread i bake since nearly a year. and there is just my reciepe, partially as answer to the perl 6 enthusiast sushee.

first of all - why I'm doing that: partially because most breads i ate suck badly (bad taste, cheap ingredients, unnecessary gimmick ingredients, poor manufacturing). I want to stay healthy and these morons try to ruin it. time to gain control here. Another reason is: I want to learn to manage my life. i mean earn money isn't enough - i can't eat money. and its good to put your love into the things you use or give your friends anyway. my motivation clearly isn't to save money since my ingredients cost me as much a bread from the bakerman.

Gtk2 + Perl = fun!

Use some modules:

use Gtk2 '-init'; # basic
use Glib qw/ TRUE FALSE /; # makes for easier source reading
use Gnome2::Vte; # generic terminal widget, will come in useful

Then we create a new window:

my $window = Gtk2::Window->new;
$window->set_title('cpang');
$window->signal_connect( destroy => sub { Gtk2->main_quit } );
$window->set_border_width(5);

That set the title, a nicer border line and also, if someone closes this window, it will ask Gtk2 to close the application entirely. That comes in handy!

Now we'll create a vertical box and put it inside the window we created:

my $vbox = Gtk2::VBox->new( FALSE, 5 );
$window->add($vbox);

The first is a flag for homogeneous - I'm honestly not sure what it means. It has a spacing of 5.

Then we create a horizontal box and put it inside the previously created vertical box:

my $hbox = Gtk2::HBox->new( FALSE, 5 );
$vbox->pack_start( $hbox, TRUE, TRUE, 5 );

Now we'll start filling the horizontal box. Starting with a label:

my $label = Gtk2::Label->new('Module name:');
$hbox->pack_start( $label, FALSE, TRUE, 0 );

Modules and commands with same name

Today I noticed that I had a module outdated, named Starman. I have no clue about what it is (ok, now I have), so I typed 'perldoc Starman'. My Mac OS X is not case sensitive (unfortunately). This resulted in the documentation of the command 'starman' to be shown. The man page says "see also, Starman".

Now, the question is... how can I get the documentation for the module, using perldoc?

Hello

First time poster, long time reader. Thought I'd take the plunge.

mongueurs blog aggregator

The French mongers (aka mongueurs) have an aggregator of all things Perl in French.

http://mongueurs.typepad.com/

Testing perl with Valgrind

Since there isn't much I've noticed blogged about the perl interpreter itself, I'll add some notes that could be of interest. In particular, like CPAN Testers, there are some people contributing tests of perl itself albeit with a lower profile and without the snazzy web site. Toward the goal of testing, I made a post to revive the "make test.valgrind" capability perl had:

GSoC Update: New objects, Perl callbacks

July already - where has the time gone? Oh wait, Twitter can tell me.

Types, Functions and something of a roadmap

In the wake of my last blog post, rurban told me Magic was more of a 'last resort', and that everything necessary for making type objects could be done with perl's pack and unpack functions, which precipitated a day or two experimenting and trying to get my head round those. Also fixed up the fundamental Ctypes::_call to return larger types properly on 64bit systems.

Looking for a Perl position?

We have an open position here at EF Johnson Technologies in Irving, Texas. You have the opportunity to work in a fast-paced, challenging environment with a team of highly motivated, brilliant and geeky people as a part of the Engineering department's Infrastructure team. The opening is for a Senior Software Engineer and requires an in-depth knowledge of Perl. The job has been posted at jobs.perl.org.

Not for the faint of heart: Installing Bricolage 2 on Mac OS X 10.6 "Snow Leopard"

Okay, I admit it: Bricolage CMS -- the open-source enterprise-class content management system -- takes a few hours to install. The upside? A well-deserved sense of accomplishment.

Seriously, as someone who works with Bricolage regularly and likes to contribute to the project (when time permits), it's incredibly helpful to be able to have it running locally on my laptop from the latest Github source.

Unfortunately, the Bricolage installation documentation for OS X needs some serious love. There are at least three contradictory resources at the moment: David Wheeler's post "My Adventures with Mac OS X" from 2002 (OS X 10.1), the README.MacOSX that Bricolage comes with, and the "Installing Bricolage on Mac OS X wiki page on Github, which only covers OS X 10.3. Thankfully, Theory (David Wheeler) is easy to find in the #bricolage channel on irc.perl.org and can be cajoled into providing helpful install hints.

All that said, installing Bricolage 2.0 on the current version of OS X -- 10.6.4 "Snow Leopard" -- was actually quite straightforward. So, before diving into updating all of the install documentation, I wanted to capture the basic process here and get some feedback on next steps. If you want to help with feedback, just jump to the Questions section at the end of this post.

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.