Get Hacking on MetaCPAN in Just Minutes

One of the fun things about MetaCPAN is that we've split the project into two main parts: an API and a front end. What this means is that if you want to start pushing your code into http://beta.metacpan.org, you don't need to run a local copy of the API. You can just git clone the front end, install your dependencies and be on your way.

Install cpanminus if you don't already have it. Then:

git clone git://github.com/CPAN-API/metacpan-web.git
cd metacpan-web
cpanm Dist::Zilla
dzil listdeps | cpanm
twiggy lib/MetaCPAN/Web.pm -p 5001 -R lib -R templates -E development

Bitcoin: Money is a sign of poverty

Some of you may have heard of Bitcoin before. This would be true if you have been following the lulsec hack of the NHS. Lulsec accept bitcoin as a donation method. There have also been some concern from the US Senate about bitcoin.

So, please read the wikipedia article above for a quick intro to bitcoin before you read any further.

I am interested in bitcoin because I like the anonymous and p2p nature of the service. While I would describe myself as a “socialist”, I still believe that there are some things that are not the government’s business and sometimes I just want to be left alone to do what I want without interference in the form of government. Another incentive for me is the cryptographic nerd in me loves the idea that you can have a completely anonymous currency using computers to do it.

Heads up: Astro-satpass modifications

The Astro-satpass distribution contains classes to compute satellite position and visibility. If you are using it, please read on.

Recently Jaap Meijers wrote to me about some inconsistencies between the satellite visibility predictions provided by the Astro-satpass package and the predictions of the Heavens Above web site (http://www.heavens-above.com/). This led to the correction of a number of bugs relating to the reporting (or not) of marginal passes by the Astro::Coord::ECI::TLE pass() method. These changes are currently available as release 0.039_04 of the Astro-satpass package.

MacOSX German Emacs keys

I've tried now up to 4 different Emacs on my german MacBook Air, and finally it looks like I can manage. Aquamacs is the best so far.

  1. xemacs my first choice as I use it everywhere else. looks awful, intolerable

  2. emacs-23.3 from ports +x11 in various flavors. Tried for 3 months. Together with TextMate, Padre, and even Eclipse. Eclipse was best and fastest, but I want an emacs as everywhere else.

  3. emacs-23.3 +cocoa patch Tried for one month.

  4. Emacs.App from ports Native cocoa patch, but german keys do not work. At all. /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs

  5. Aquamacs This is it! Like my XEmacs on Windows and emacs on unices. See also http://www.emacswiki.org/emacs/AquamacsFAQ#toc5 And with the following key settings I can finally type my programs.

.emacs

releasing to [remote] minicpan (preferably with Dist::Zilla)

Traditionally at $work we do a git clone of our various repos and run the projects straight from the working directory, but lately I've been moving towards the good habit of packaging small related components into their own dists ("I \N{HEAVY BLACK HEART} Dist::Zilla"), so the desire for a real company darkpan has been increasing.

I have a combination minicpan/darkpan that (mostly) works right now using:

One advantage of using CPAN::Mini::Inject::Server is that you can run it as a designated user and anybody who has access to the server can post to it.

I got it running with this app.psgi:

YAPC::Europe talk slots stats

I've made a draft calculation of what we've got in talk proposal list regarding time limits.

There are 36*20 + 28*40 + 10*60 + 120 = 2560 minutes of submitted talks right now.

Out of those there should be 5*60 + 40 = 340 minutes of talks to be given in one thread, thus having 2200 minutes (37 hours) in parallel.

As we'd like to start not earlier than 10 a.m. and wrap up at 6 p.m., minus 1 hour lunch, minus about an hour for coffee breaks and breaks between talks we come to 6 hours of talks a day, minus 1.5 hour of those given in one thread (keynotes and lightning talks). Not counting an auction.

Thus we can have 4.5*3 = 13.5 hours of parallel talks during the three main days, which is 40.5 hours if we have three rooms, and 54 hours if we have four.

If every submitted talk is accepted, we already are able to fill three talk rooms for the whole conference.

In any words, as we have four rooms, we can still accept about 14 hours of talks without renting yet another room.

Submit a talk right now if you'd like to give it at YAPC::Europe in Riga!

Combining Syslog and DBI

Saw an interesting interaction today. The Sys::Syslog module makes use of fork to prevent a blocking write to the console. Unfortunately, this means that if you are connected to a database via DBI and try to log anything via syslog, you'll run the issue of the DBI handle being closed under you. Even the DBI property of InactiveDestroy cannot save you b/c of the fork being hidden in Sys::Syslog. Thanks to David E Wheeler for the DBI AutoInactiveDestroy attribute which saves the day!

VS2010 Is Too Old?

> cpan Win32::Console::ANSI

ANSI.xs(12) : fatal error C1189: #error : your SDK is too old... (see the README file in the distro)

Fix:
@Set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
@Set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE

Perl Epigraphs

Many Perl release announcements included an epigraph, a short excerpt from a literary or other creative work, chosen by the pumpking or release manager. This file assembles the known list of epigraph for posterity, and also links to the release announcements in mailing list archives.

It's quite interesting to read through the epigraphs in epigraphs.pod - a small insight into the Perl pumpkings. How many epigraphs do you recognize?

Installing Local Perl And Libraries On Mac Book Snow Leopard

I recently installed Perl 5.14 on a new Mac Book running Snow Leopard so I thought I'd share my findings and experiences to save the next person doing this some time.

I started off by doing a search on Google for "install perl mac".
Hit number 1: Download Perl - www.perl.org http://www.perl.org/get.html

That suggests you have a perl already installed, which is currently perl 5.10, or you can use App::Perlbrew.

It wasn't quite that easy so I've documented below exactly what I did. I've given feedback to Leo Laporte who looks after http://xrl.us/installperlosx and who should be updating the instructions on the perl.org page. At that point something like "curl -L http://xrl.us/installperlosx | bash" will work.

one-liner for separating iCal events by category

Attempting to move a friend from Outlook to Google Calendar, we exported the calendar to an iCal file.

I wanted to create separate Calendars for each event category.

I searched cpan for modules to read the file and found iCal::Parser, Text::vFile, and Text::vFile::asData.

I really didn't need to parse the data, because then I would have to figure out how to unparse it, and i didn't want the data to get messed up in the process.

I was definitely justified: simply doing iCal::Parser->new->parse($file) put my CPU at 3.5 load for 2+ minutes, whereas this one-liner takes a fraction of a second:

perl  -MIO::File -nE 'if(/BEGIN:VEVENT/){ warn("event not ended: $e") if defined $e; $e = $_ } elsif(/END:VEVENT/){ $e .= $_; $e =~ /^CATEGORIES:\s*(.+)\s*$/m; ($n=$1||"")=~s/\W+/_/g; ($fh{$n} ||= IO::File->new("cal-$n.txt", "w"))->print($e); $e = undef; } else { (defined($e) ? $e : $v) .= $_ } END { print $v }' outlook.ics > leftover.txt

Then a bit of verification:

A Pink Camel in the wild

Poor camel. Who would do such a cruel thing?

pink_camel.jpg

Also, that monkey looks like it's about to take a crap on Amsterdam.

Perl 5.12.4-RC1 is now available

Pheasant is pleasant, of course,
And terrapin, too, is tasty,
Lobster I freely endorse,
In pate or patty or pasty.
But there's nothing the matter with butter,
And nothing the matter with jam,
And the warmest greetings I utter
To the ham and the yam and the clam.
For they're food,
All food,
And I think very fondly of food.
Through I'm broody at times
When bothered by rhymes,
I brood
On food.

-- Ogden Nash, "The Clean Plater"

I've just uploaded the first release candidate for Perl 5.12.4 to
PAUSE. You should be able to find it at:

http://search.cpan.org/dist/perl-5.12.4-RC1/

Here are the changes:

http://search.cpan.org/dist/perl-5.12.4-RC1/pod/perl5124delta.pod

SHA1 sums for this release are:

c46cfc3016367115898d9de8d61847d090b6bd18 perl-5.12.4-RC1.tar.bz2
820fecbd90f645306818a92bffdd5af585ad41df perl-5.12.4-RC1.tar.gz

It's very important that you test this release with any software written
in Perl which you use or maintain. If no "showstopper" class bugs are
found in the next few days, we will release a virtually identical
tarball as Perl 5.12.4.

Cheers, Leon.

App::PipeFilter for Top-N Reports

I'm testing some software at work by replaying pcap files at the application. I want to make sure the results in the database match what's in the original packet dump. There are hundreds of packet producers. I want to focus on the top ten to make better use of my time.

I've written a utility to dump interesting packet data as streams of JSON objects, one per packet. Each object includes the source and destination IP and port, among other things.

% jcut -o src_ip -o dest_ip deleteme.json | head -3

{"dest_ip":"10.10.91.77","src_ip":"10.16.250.39"}
{"dest_ip":"10.10.91.77","src_ip":"10.0.250.80"}
{"dest_ip":"10.10.91.77","src_ip":"10.90.250.39"}

A "top N" report for any single field is trivial. Extract values for that field and pass them to sort(1), uniq(1) and tail(1)

CPAN Testers Summary - May 2011 - Little Lights

May has been a bit of a quiet month, although a few things have been happening in the background. The continuing work of packaging the websites is ongoing, and the plans for the Admin site are coming together. Having said that we did pass the 12 million reports mark in the middle of May too :)

We had a few reports that the testers themselves acknowledged were inaccurate. Although the new Admin site will eventually allow testers and authors to tag reports, the site isn't quite ready for release yet. As such, I now have a script, which uses the guts of the forthcoming Admin site, to hide broken reports. The reports are not deleted, as they may be of use in the future, but hidden from the statistics calculations. If your smoker does send a selection of bad reports, please let me know, and I'll see if I can hide them. As mentioned, the Admin site will eventually take on this role more officially.

Introducing metacpan.org - A better search for the CPAN

I'm very excited to announce the front end for MetaCPAN: metacpan.org . This is what you can expect from the new interface to the CPAN:

Hey Nelson, or, Perceptions

Hey Nelson,

While I’m delivering the news, here’s something for you ignorant American backwoods motherfuckers. Some people’s names have “special characters” in them. Like François Rabelais or Björk Guðmundsdóttir or 艾未未. It’s 2011; the only software that can’t handle Unicode properly is Perl. (As if you needed another reason not to use Perl.)

please quit being an ignorant backwoods motherfucker and stop talking shit about crap you don’t know anything about.


To the Perl folk reading this — the problem we’re dealing with in terms of perception nowadays is confirmation bias. Nelson hates Perl, sees one question on StackOverflow that is making the rounds because Tom answered with one of his obsessively detailed (and therefore huge) missives, generalises wildly from a shallow read of the QA, and then – surprise – finds his opinion further confirmed.

Installing IO::All on Win32 (no Cygwin)

IO:All 0.41 can be installed successfully on Win32 (no Cygwin), if the test fails and spews something like this:

# Failed test at t/file_spec.t line 28.
# got: '33'
# expected: '34'
# Looks like you failed 1 test of 27.
t/file_spec.t ........
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/27 subtests

The alternatives:

  • fix your %PATH% of more than one partition character (';')
  • fix t/file_spec.t

the "everything is a file" metaphor

Frankly I never got it until recently. Sure, I had some informal contacts with plan 9, the OS that is entirely designed around that concept. First when Linus talked about the features he borrowed for Linux, later I borrowed myself features from Plan 9's editor acme for Kephra. But yesterday I saw a talk from the author of MacFuse and I really got a hang of it.

And suddenly I realized the implications for a better Kephra that I currently design. When it read and writes FIles it should have hooks to do whatever (aka *). Not only be able to write files on remote machines via ftp/sftp/*. But also use it to literally edit *. I mean, why do I have to use the clunky Wiki editors, when I can have Kephra, where I'm twice as fast and can store the relevant parts of everything i write in the right places for later reuse? Even that box i currently typing in sucks compared to any decent editor. And please with the right module (Mechanize and friends) its a handful lines to do that.

I really enjoy this (4th or 5th) rewrite.

Display your data - Random::PoissonDisc

I read this nice article on map generation and naturally want to write something like it, but in Perl. For the first step, I want to distribute points nicely across the plane, by using the Poisson Disk Sampling method outlined in the article. Implementing the algorithm was straightforward, but how would I know that the output data was correct in the sense of reaching my goal of uniform but randomly distributed points across the plane?

The test program of Random::PoissonDisc conveniently outputs the generated points to STDOUT. For visually inspecting the data, I can then pipe it into App::ffeedflotr which displays a nice point cloud. The first output of Random::PoissonDisc looked like this:

perl -w bin/random-poissondisc.pl -r 10 | ffeedflotr.pl --type=scatter

Image of wrong distribution

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.