Official Hash Tag: #yapcna2012

If you make any posts about YAPC::NA 2012 and wish to tag it, please use #yapcna2012 as the official hash tag.

Perl testing with Jenkins/Hudson: avoiding some pitfalls

Having continuous integration is incredibly helpful and setting up a Jenkins server is surprisingly easy. However, configuring Jenkins to run your Perl unit tests is a wee bit harder, although it may seem easy at first. Here are a couple of issues I ran into and some things I learned:

We all know that Perl unit tests, aided by Test::More and prove produce results in TAP format. But since Jenkins is Java and someone once dictated that Java shall only read XML and only write XML, Jenkins expects test results to conform to the JUnit XML format. Well, OK, if they want XML, let's give them XML. So you turn to your favorite search engine and ask it how to transform TAP to JUnit. You will, of course, find something. And since that something was actually written by Justin Mason of SpamAssassin fame, you stop searching at that point and download that conversion script.

Dan's updates for two weeks ending Sept 4, 2011

Last week was a short week for me because I was doing a lot of work up at camp for the Scouts. So here's a two-week update:

TPF:

  • I've been learning a lot about "Level 2" and "Level 3" credit card transactions.   It turns out that when you start handling corporate and government issue credit cards through your gateway, the rules change.   And, if you don't comply with those rules, you end up paying a lot of money!
  • That prompted me to check into how much money we're paying in transaction fees, and I manage to get the bank to drop those rates for us.   JT Smith has also been checking around with other gateways to try to find us an even better rate.
  • The Perl 5 Core Grant fund now has 5 donors that have set up monthly recurring donations via donor.com.   So far, we've collected about $1,200 from non-corporate donations.

PPW :
  • Things are really coming together now.  Several sponsors have sent in their money recently, and we now have enough talks to put on an event.  By the time this blog is published, I hope to have the schedule published.

MOPing with Moose

I’ve used Moose regularly now for a couple years, but really only so far as most people do, as a handy accessor generator and type checker. But my most recent project has called on me to delve, first into Roles, which are a lovely way to teach old classes new tricks, but I found I wanted to do deeper magic…

Now, as I wrote about before, my project is a Node.js style event system for Moose. Moose classes have two types of things associated with them, attributes and methods.

I allow users to declare that their class will emit a particular event through a helper method. You just write:

has_event 'connected';

YAPC::NA Planning Meeting Tonight

It’s the first Tuesday of the month, so that means it’s YAPC::NA Planning Meeting time. If you’re in the Madison area, or don’t mind a drive there is a YAPC planning meeting tonight at the Essen Haus at 7pm. As always the food and beer are sponsored by Plain Black, and the room is sponsored by Essen Haus.

We’ve got a lot to discuss so the meeting will probably last until around 9pm, but you’re free to come and go as you please.

The volunteers - VIPs every event need

An event can't be done without them and every organizer ist happy when there are lots of these people - the volunteers.

Only a few minutes after the announcement that we host YAPC::EU 2012 some people came to me to offer their help...

Getty will do all the social media stuff, Wendy offered to help at the event (help with registration desk, help people to find the rooms, ...), and Steffen, Roman, and Gabi offered to help with stuff that can be done remote.

There is enough to do :-)

We'd like to say thanks in advance. You rock!

Looking up the location of an IP address

This review of perl modules for looking up the location of an IP address is now hosted elsewhere.

Using modules that are not installed

Yesterday I stumbled across an error message of perl5 I've never seen before:

Can't locate loadable object for module X in @INC

I was trying to test a module A that uses a module B that isn't installed. The perlmonks told me that it had something to do with DynaLoader.

I already had a

use lib "'MODULEB/blib/lib";

in my setup.

What made it work was an additional

use lib "'MODULEB/blib/arch";

The reason is that module B is XS based and results in a moduleb.so. DynaLoad looks for this moduleb.so and is only able to find it if the "arch"-directory is in @INC.

Since the application has lots of modules that use each other, I've come with the following snippet I include in every test:


BEGIN {
  my $fh;
  # this is the directories where all modules are in seperate directories
  my $dir = '..';
  opendir($fh, $dir) || die "can't opendir $dir: $!";
  my @entries=sort readdir($fh);
  closedir $fh;

  # get rid of '.' and '..'
  @entries= grep { /^[^.]/ } @entries;

  # add the directory name to get a name we can give 'use'
  @entries= map { "$dir/$_" } @entries;

  # we only want directories ...
  @entries= grep { -d } @entries;

  # expand @INC
  for my $dir (@entries) {
  # Perl-only modules
  eval "use lib '$dir/blib/lib'";

  # modules with XS
  eval "use lib '$dir/blib/arch'";
  }
}

That naturally gives me a quite impressive @INC.

cPanel is one of those critical pieces of infrastructure that...



cPanel is one of those critical pieces of infrastructure that you often don’t think about, but that makes the world a better place for so many people. It’s available from web hosts around the world to make hosting a painless point and click experience rather than a frustrating conundrum of editing config files. 

I’m pleased to announce that cPanel is our first Diamond Level Sponsor for YAPC::NA 2012. And they’re also hiring!

Why work at cPanel?

We speak Perl

cPanel & WHM is developed in Perl. cPanel has and will remain a proud supporter of the Perl community. At cPanel, we welcome both seasoned Perl Developers and promote internal advancement of learning Perl through various venues such as attending YAPC::NA, in house training, Perl Mongers and working side by side with Perl experts.



Benefits

cmd to compare contents of two directories

diff -qr dir1 dir2

Making RESTful Dancing easy with Dancer::Plugin::REST

An useful plugin for writing RESTful Dancer web applications is Dancer::Plugin::Rest by Alexis Sukrieh, available at https://metacpan.org/module/Dancer::Plugin::REST.

To use it when defining routes, easily:


package MyApp;

use Dancer;
use Dancer::Plugin::REST;

This exports the resource keyword, which can be used as such:


resource camel => (
create => sub {},
get => sub {},
update => sub {},
delete => sub {},
);

This automatically creates the following route handlers:

  • post /camel (create)
  • post /camel.:format (create)
  • get /camel/:id (read)
  • get /camel/:id.:format (read)
  • put /camel/:id (update)
  • put /camel/:id.:format (update)
  • del /camel/:id (delete)
  • del /camel/:id.:format (delete)

The format param can be used in requests such as


GET /camel/larry.xml

Next to that, this module exports a whole bunch of error handler methods, such as

  • status_unauthorized
  • status_ok
  • status_length_required
  • status_not_found
  • status_forbidden

which can be used to make life easier:


return status_unauthorized("Not Larry") unless $user->is_larry;

Logging wide characters with Log4perl

I gave my "Surviving Perl Unicode" tutorial at the Mad Mongers this weekend. After I mentioned Test::Builder's Unicode issue, JT Smith asked how I would silence wide character warnings from Log::Log4perl. I'd never really thought about it.

For instance, here's an easy program that wants to output U+2020 (ᴅᴀɢɢᴇʀ):

use utf8;
use strict;
use warnings;

use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init( level => $DEBUG );

DEBUG( 'Is this a † I see before me?' );  # warning

I get this warning:

Vim vs Emacs

This contest is a no-holds-barred match, and is scheduled for one fall. In the corner to my left, hailing from vim.org and weighing in at an awkwardly anemic 9.1MB - Vim! In the corner to my right, hailing from gnu.org and weighing in at a morbidly obese 46MB - Emacs! 

At YAPC::NA 2012, we will once and for all declare a definitive winner in the decades old battle between Vim and Emacs! Two editors go in, but only one comes out. Be there to witness this history making event!

MetaCPAN August Roundup

August was another busy month for MetaCPAN, so I think a recap is in order. I'll proceed chronologically.

2011-08-01

Gabor Szabo included MetaCPAN in his first issue of the Perl Weekly. It's an excellent aggregation of all Perl things blog and newsworthy. I can tell you just from the time involved in a MetaCPAN recap that Gabor is spending a huge amount of time on his weekly newsletters. I follow a lot of blog posts, but I find his weekly recap helps me find interesting stuff I may have missed.

2011-08-03

On Unicode and Sorting

Tom Christiansen published an article on Perl.com on the topic of sorting and unicode.

It's good and it explains a little bit about why Unicode is so difficult and why sorting Unicode (or even ascii) is even more difficult, mainly because it depends on your local definitions what results you expect from a sorting operation.

It might be nice to point out that the modules he proposes on using, Unicode::Collate, and Unicode::Collate::Locale, have been in core perl since 5.8 and 5.14, respectively.

Happy sorting!

CPAN Testers Server Failure

Unfortunately the CPAN Testers server has a failing hard disk, which is only allowing READONLY mode access. As such, all CPAN Testers operations are now failing.

The host company has confirmed that ...

a) our disk has a fault
b) we don't have a second RAID disk (even though we're paying for it!)

As such to replace the disk it requires complete data loss!

As you might anticipate this is not making me happy today. I had already started making plans to migrate to a new server, but to do this gradually over the next month. However, it looks like this will need to be sped up.

As things stands the CT server is effectively out of action. I have read access, but will need to wait until the new server is ready before I can copy over everything as it currently stands. Although I have several backups of data, I would rather avoid rebuilding the complete set of data files.

This is a shot of the Distance Education Room 235 in the Pyle...



This is a shot of the Distance Education Room 235 in the Pyle Center where some of the talks for YAPC::NA 2012 will take place.

Method::Signatures::Simple 1.01 released to CPAN

I’m pleased to announce version 1.01 of Method::Signatures::Simple. It provides a little sugar for writing methods and functions. Chip Salzenberg requested the addition of a function keyword with the same signature processing, and kindly provided me with the implementation (on github).

Here’s some example code from the synopsis:

Padre 0.90, the Delayed Release Announcement

Normally when Padre, the Perl IDE is released, we like to let people know about it through the release announcement. It serves a dual purpose. it both lets us acknowledge the awesome work that goes into Padre while letting everyone out there see what has changed, what has been fixed and where we are in terms of the project and whether or not it's ready for your use, or to upgrade.

0.90 was released with little fanfare, so I'd like to take the time now to cover off some of the changes in Padre 0.90 in a little more depth.

OK, so I can't help myself here, but with the work done by Ahmad Zawawi to bring us a modern Scintilla with the Wx::Scintilla package, we now get squiggles!

Kickstarting the Gitpan

If you've played with Gitpan at all, you probably have an idea of how cool this project is. The idea behind Gitpan is to take all of CPAN and make it available as Git repositories which are tagged by release. It's a great idea. It makes it trivial for Github (and Git users in general) to create patches for modules which don't already exist in a public Git repo. It's also useful in the case where the original Git repositories for modules on CPAN may no longer easily be found online.

Now, if you've followed the Gitpan project, you probably also know that it is not currently up to date, which is a shame. I contacted Schwern about this recently and he was kind enough to create and tag some issues which are blockers to the resumption of Gitpan.

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.