YAPC::EU 2010 videos are on YouTube

The YAPC::EU 2010 team has uploaded to YouTube videos of the conference in the yapceu2010 channel. There's even one of me presenting the White Camel Awards to cog and to Barbie. I don't think I'm terribly interesting, but I like their comments as they accept their awards.

Paul Fenwick couldn't be there, but maybe someone can convince him to do a video acceptance speech. He's dressed as a Star Fleet officer, a pirate, and a mad scientist. What should he be in the video?

Random Perl wishlists #1: uncapture modifier, require+import, backtick function

Uncapture modifier. The new /r regexp substitution modifier in Perl 5.13.2 indicates that there might be hope for even more modifiers in the future. A possible modifier might be one that ignores all capture groups, which can solve this guy's problem.

require that can also import. I wonder why "require" doesn't also support importing like "use" does: use MODULE_NAME LIST... since it already support "require MODULE_NAME". This way, whenever I want to defer loading some modules, I can just replace "use" with "require" and put the statement under some "if" statement.

the backtick function.. Do you find yourself often having to do use a temporary variable like this, $cmd = "some longish and ".quote("complexly formed")."command"; before doing backtick `$cmd`? This is because unlike in PHP, we have system() but no backtick(). Most probably remnants from shell. There is Capture::Tiny for more general solution but of course it's a bit more cumbersome.

Resurrecting Glasgow.pm

During YAPC::EU mst suggested "why don't you just start Glasgow.pm?"

I talked about it a bit with a friend who'll be back in the country soon enough and even today at work, and I think we may have enough people to kickstart the new Perl mongers group.

I know there are several businesses and people in the West of Scotland who either use or like Perl, so I am hoping that enough of them would like to join the group.

I've sent the request to pm.org's support to reinstate the old Glasgow.pm. I will endeavour to bring the mailing list and website up as soon as possible, and will start reaching out to people who use Perl in the area. Dear lazyweb, could you help me?

Ubic - how to implement your first service

I had a hidden agenda when I asked on this blog about how do you run your daemons.

There is a tool I recently opensourced. It can be compared to classic SysV init script system or to daemontools, runit or upstart, but it already is better and more flexible at least in some of its properties (otherwise I wouldn't bother to implement it :) ).

It is called Ubic and it is a toolkit for describing daemons in pure perl.

Ubic service is simply a perl object of some class inherited from base Ubic::Service class. Ubic loads service descriptions from /etc/ubic/service/ directory. To create your first service, you have to write something like this:
# cat >/etc/ubic/service/test
use Ubic::Service::SimpleDaemon;
return Ubic::Service::SimpleDaemon->new({ bin => "sleep 1000" });
"ubic status" command can show you status of all or some services on host:
# ubic status
test	off
ubic-ping	running
# ubic status test
test off
Now, as you probably already guessed, to start service you simply have to say "ubic start":

spreading perl on multiple level // please help with your codexp

jejky, I got a TPF grant. Even if scheduled it for 7 month, I plan to be ready end of this year. I think it will also appear in the first Module I ever uploaded to CPAN: Perl6::Doc, so you can grok perl 6 too. More info about that on my Perl 6 related blog.

Last weekend i was in Bonn at Froscon standing at perl booth, giving a talk about perls testing modules and we were talking there about educational material. I say education not PR. Because if there was a satan, pr is one of the best evidences of his existence. I speak of education in the best sense. No bragging, no flattering, no hot air. just knowledge, delivered entertaining. As part of that we want posters and slides showing perl code snippets that are eaysy readible, even to python programmers and powerfull. so lets open 4 categories. perl <5.10, 5.8<, modules and 6. I have some ideas but please send me your best lines, so that we can show it at conferences.

thank you very much.

Crypt-SSLeay 0.58

Earlier today, I uploaded Crypt-SSLeay to CPAN with much trepidation.

I am hoping that the module is in no worse shape today than when I joined the project as a co-maintainer. As I outlined in response to brian's post, I plan to work on multi-threading support for the next release.

I would also like to add more tests.

If you use this module (i.e., if you use LWP or WWW:Mechanize with HTTPS), please try out development versions in the upcoming weeks and report bugs.

Help newbies, your project and the community - README

If you want newbies to help you with a project - in fixing code, writing tests or even documentation - my course students will be given a course completion project to help out an open source project. That project can be yours!

Background:
I've been very inspired by DJB (Daniel J. Bernstein) and his course on UNIX Security Holes. The highlight to me was how his students interacted with the outside world - something I personally never did while studying programming (or anything else, for that matter) at school. I saw two of my brothers go through their degree (computer science, biology), helped with their homework and even attended some classes. They too never interacted with the outside world! I decided I want this changed in my course.

Javascript: adding a unique ID to every object

This entry is about Javascript, not Perl. It's about object identity in particular.

If you have two objects in x and y, you can check whether they're really the same object with x === y. However, as far as I know Javascript provides no way to get an object's address (which you could use as a key in a hashtable or whatever). The following code attempts to fix this problem by adding a unique ID to every object (and I do mean "every"):

Ponies are the truth

Did you know you can modify perl's readonly constants for undef, true and false? Yep.

&Internals::SvREADONLY( \ !!1, 0 );
${ \ !!1 } = 'ponies!';
&Internals::SvREADONLY( \ !!1, 1 );

print !!1; # ponies!

Same thing for \ undef and \ !!0.

Tiny vim convenience hack

Since I maintain a lot of code that wasn't originally written by me, I am in the unfortunate situation that I get to edit code with many different coding and indentation styles on a regular basis. Reformatting usually isn't a good idea since not only may the original author object, but the revision control history is more important than code and indentation style.

I'm a vi(m) user. Modifying the settings to suit whatever insane tab-compression-indentation scheme some crazy emacs user decided on for individual documents is severely annoying. My editor should do this for me. If I was using Padre for my daily work, it would do this for me automatically. Today, finally, I sat down and wrangled vi until it would auto-detect the indentation style of the current document. More precisely, Text::FindIndent does (version 0.09 was just released and is required). Install the module, include this in your .vimrc on one line:


map <F5> <Esc> :perl use Text::FindIndent;VIM::DoCommand($_) for Text::FindIndent->to_vim_commands(join "\n", $curbuf->Get(1..$curbuf->Count()));<CR>

Now, open up somebody else's source code that uses some crazy indentation scheme. Hit F5. Your vi settings have now been marvelously modified to produce the same broken indentation as whatever you opened for editing.

How do you run your daemons?

How do you start and daemonize your programs (PSGI apps, fastcgi apps, gearmand, several memcached instances, custom handcoded daemons)?

Do you write custom init scripts?
Use daemontools or upstart?
Do you simply invoke plackup in terminal? :)
Maybe you spawn your fcgi apps directly from your webserver?

Do you need watchdogs? Do you actually write them?

CPAN Search Dependents

When I search CPAN, I frequently find it hard to tell which modules to choose. Unless my needs are very specialized, there can be lots of modules that do what I need. But how would I know which module is best to choose?

One factor that can help me decide is the number of CPAN dependents each module has. (Don't confuse "dependent" with "dependency"; I use the word "dependent" to mean: other modules that depend on it.) If a module has lots of other modules that depend on it, then I can be relatively certain that the module might be worth relying on.

The information about the modules' dependents is exposed by http://deps.cpantesters.org/depended-on-by.pl, which is rather cumbersome to use.

So, I created a greasemonkey script which dynamically shows the number of dependents for each module on the search.cpan.org search results. It then displays the list of distributions in order of their numbers of dependents.

CPAN Search Dependents - is the link to the greasemonkey script.

Switching CPANPLUS test reports to Metabase

With the switching off the CT1.0/SMTP mechanism on September 1st casual CPAN testers, those users who submit test reports when they install or update their modules, will need to switch to the new Metabase system.

For CPANPLUS users this just got a little bit easier.

Task::CPANPLUS::Metabase should make configuring CPANPLUS a lot easier. Simply install Task::CPANPLUS::Metabase, which will install all the necessary modules, then run the metabase_cpanp script to setup a Metabase ID file and configure CPANPLUS for sending test reports

Age discrimination in Perl 6 using subsets and multiple dispatch

I recently read a blog post by Alex Miller about Clojure multi-methods.

It described and answered a question his friend had asked him, as well as discussing some related problems. I'm going to showcase the different options Perl 6 provides for solving these same problems. Here's the initial question:

Is it possible to write a multimethod that has defmethods which handle ranges of values? For example, say that a person has an age. Can I write a multimethod that accepts a person as a parameter and returns "child" if age < 16, "adult" if 16 <= age < 66 and "senior" if age >= 66?

As in Clojure, the answer is "Sure." In keeping with TIMTOWDI, Perl 6 provides several ways to do this.

First, let's define our Person class:

class Person {
    has Int $.age;
    has Str $.name;
}

Perl and Parsing 4: The Golden Age of Right Parsing

Like political views, parsers are often divided into left and right. Also like political views, the left-right classification is more hindrance than help in some cases. Earley's algorithm (my main interest) is one algorithm that does not fall into either category.

In this post I want to start to talk about those parsers which can be neatly classed as left or right. First off, to say a parser is a left or right parser does not describe the direction in which the parser works. The working direction of any parser is always left-to-right, except in the very rare cases that it is stated otherwise. Every treatment of parsing theory I've seen follows this convention. Right-to-left parsing is useful sometimes in practice, but the theory of right-to-left parsing is simply a mirror image of the theory for left-to-right parsing.

Why uvar magic must die

Uvar magic must die. Maybe it’s too late for a complete removal, but it’s use should at least be discouraged. One of the reasons is that it’s actually two very different things that don’t have all that much in common.

Scalar uvar magic

Scalar uvar magic isn’t actually evil, it’s just fairly useless. It’s a way to add get and set hooks to scalars. It may have been a useful interface back when it was introduced in 1993, but with the introduction of custom magic vtables in 5.8 it stopped particularly useful. The new interface is more powerful in many ways and in typical cases it that takes less code to use. There’s absolutely no reason why anyone should still be using scalar uvar magic unless you have to maintain compatibility with 5.6.

Hash uvar magic

Add more RSS feeds to your reader (using Google Reader)

I try to encourage my students to join the Perl community as an aid of learning. I always stress that the community is such a learning benchmark, it is practically considered vital.

While showing a student how to work with Google Reader (since he already integrated much of his life into Gmail and the Google Calendar), I noticed something I overlooked before: you can specify search terms for subscription adding and it will search that through known RSS entries and let you pick which ones you want to subscribe to.

In Google Reading, click on "Add a subscription" and write down "Perl". Then you can skim through RSS feeds which have something to do with Perl. Some are websites that had an article on Perl (Wired, for example) and some are help forums (Experts Exchange - which I personally don't care for) but some are hardcore stuff like Ironman (one of the tops), blogs.perl.org, use.perl.org, etc.

I've added: PerlMonks, Reddit, RegexGuru.com, Ironman, Modern Perl Books, The Perl Foundation, Plack, Perlcast, freshmeat.net's Perl, Perl is Alive, Perlsphere, Tim Bunce's blog (just in case it's missing from any aggregator!) and Proud to Use Perl.

Which Perl XML module should I use to ...?

I asked Which Perl XML module should I use? on O'Reilly Answers to survey people about their XML module use, but my question was too general. Before you can recommend an XML module, you need to know what the task is.

I've refined the question into three more specific questions:

Maybe someone should start the same sort of questions for Perl web frameworks or any of the other topics that have multiple (hence, confusing) options.

Adventures with Dist::Zilla - 2 - Weaving The Pods

I've been spending a bit of time this week looking at Pod enhancements for Dist::Zilla released modules, I have hit a bit of an impasse.
I quite like the [Availability] Pod::Weaver section plugin - Pod::Weaver::Section::Availability, however currently it hardwires some of the information to make it specific for the author (and unfortunately that means that the module name space is polluted by this). I'm just working out the best way to parameterise this information - although its a little tricky since really Pod::Weaver should work outside of Dist::Zilla, and the mechanisms I can see others using are grabbing information from Dist::Zilla for it...
Less controversial is the [BugsRT] module (Pod::Weaver::Section::BugsRT) which adds bug tracker information to the POD.
The two of these together should allow me to get released modules with pods how I like them.

The Optimum YAPC Attendance

In my recent post about promoting YAPCs, Gabor picked on something regarding the optimum number of attendees. I think he makes a good point that for a conference like a YAPC, 300-400 attendees is a good number to aim for. Anything more and it can become a logistical nightmare for organisers. It also means that the conferences themselves can become a little more impersonal, when a major aim of YAPCs is to bring people together.

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.