Perl: The Next Generation

We feel it is our duty as YAPC::NA organizers to do everything we can to bring new people to Perl. After all, without fresh meat, Perl's future wouldn't be very bright.

This year we're doing a whole host of new things to recruit new talent into the Perl community. Collectively, we're calling these programs, Perl: The Next Generation. Here's what we're working on:

Video at 4.5 million frames per second...

Hi Folks

Yep, it's coming to a lab near you. Err, if you're in Europe.

X-ray camera.

This web site is one of my favourites.

When module installation fails

Edit Notice: I edited this post because of a very valid point made in brian's comment below.

I use perlbrew for managing my Perl installs as I am sure many people do. I was searching around metacpan for helper modules for perlbrew and found Bash::Completion::Plugins::perlbrew . I think this might be useful so I install it,
cpan Bash::Completion::Plugins::perlbrew 

and I get a “don't know what it is.” error. I changed my cpan urllist to point to http://cpan.cpantesters.org and reloaded the index and still no dice. I am still unsure why this is not working so I decided to try installing just Bash::Completion and it fails during t/05-utils.t .

So now what do I do? I really do not need to install Bash::Completion::Plugins::perlbrew or Bash::Completion but I do not like how they failed to install. Time to submit a test report.

I found the process quite easy by following the test during install instructions .

July 31st

PPW

  • We need more sponsors. I've been working on a few leads, trying to make sure we can pay for everything.
  • Web site updates
  • Working on schedule template for the event.   There's a lot of debate over starting time.  Traditionally, people complained we started too early.   But, if we start any later it really makes for a short event once you subtract out all the breaks and meals.

TPF

  • Working with accountant.   We need to get all the YAPC records reconciled with our bank account.
  • Made history this week by processing the first ever set of monthly recurring donations to TPF.
  • Paying bills.   TPF is an associate member of the Unicode consortium for another year.
  • I've confirmed there's a problem with the YAPC checks.   They were mailed to the bank for deposit.   But, the bank never received them.   Now, I'm kicking myself for not using delivery tracking.   I've mailed in deposits several times in the past and never had this issue.  At least I have a scan of all the checks.   If they don't turn up soon, I'm going to have to write all the people that wrote checks.  I'm really not looking forward to that.

Other

  • Upgraded to OS X Lion and hating it.

ACT Running From Plack

I'm proud to announce that our dev team has officially gotten ACT (the conference registration system used by YAPC) running on Plack. Check out the github repo. We still have more work yet to do. There's still one test not passing, and lots of features to add, but you can start it with plackup, register, login, change your profile, change your password, etc.

If ever you wished ACT had a feature you thought it was missing, it just became a lot easier to add.

If you can't make money, at least have fun.

There's a saying: "If you can't make money, at least have fun." My open source projects have never earned a profit, but they've been enormous fun.

They've put me in the position to meet a lot of great people and go to interesting places. It's hard to imagine having more fun than I did speaking at Perl Oasis and YAPC::NA this year. If anyone releasing projects in other languages has more fun than this, how do they survive?

But giving away software is only fun when people use it. Otherwise it's just saving public backups or something.

So hearing that DomainSponsor's distributed server architecture uses one of my modules made my weekend. It was an awesome feeling, and it put me in the mood to update five distributions in the past couple days.

And write a blog post, which you're reading. Thanks, by the way.

So if you're using CPAN modules (and can talk about it, of course) let us authors know. Because most of us aren't making money at it, and you'll help us have more fun and release more code despite that.

Calling PL/Perl SPI from within a module.

You may or may not have noticed that you can't simply call PLPerl SPI subroutines from within your module. What happens is you get an error saying cannot find Package::Name::spi_*. This is because the PL/Perl SPI subroutines are not provided as perl CORE functions but rather local subroutines in the main:: package.

What can be done?

You may be tempted (as I was) to pass in an anonymous sub routine reference to your module like so:

return Package::Name->new()->process( sub { return spi_exec_query(@_) } )

This may seem like it would work, but you then run into problems because the spi_* PL/Perl subroutines have a prototype that restricts you from passing in an array. So you end up with code more like:

return Package::Name->new()->process( sub { return spi_exec_query($_[0], $_[1]) } )

Which, as you will agree is just plain ugly. So, to overcome the prototype you can instead call it like this:

return Package::Name->new()->process( sub { return &spi_exec_query(@_) } )

Unicode: The Good, The Bad, and The (mostly) Ugly

Tom Christiansen's slides for Unicode Support Shootout "The Good, the Bad, & the (mostly) Ugly" should be required reading for anyone working in Unicode in my (unfortunately arrogant) opinion.

The Game Crafter

I'd like to see more people talk about their successes with Perl. I don't think we do a very good job of promoting successes. So while there are lots of great Perl apps out there, we as a community need to talk about them more. So I'll start, and I hope to hear more from you guys.

The Game Crafter is one that I'm very proud of. It's completely written in Modern Perl using Moose, DBIx::Class, Dancer, ElasticSearch, Image::Magick, and over 100 other modules, and deployed on Perl 5.12 (cuz 5.14 came out just before we launched it).

MetaCPAN::API gets updated

Recently I found some spare tuits and decided to spend them on MetaCPAN::API.

My main problem with the old MetaCPAN::API was that I had made a wrong design decision, and failed to take into account the flexibility of MetaCPAN. It really is flexible.

The second time around I decided I'll write it correctly, and test it thoroughly. I've moved to version 'v0' of the API (what was referred to as 'Beta API') and this helped clean up quite a bit. I was able to write it the way I wanted.

Tim Bunce (who I actually had the pleasure of meeting last YAPC::EU) had opened a ticket asking for complex POST requests. This got me thinking and that day I implemented complex GET requests, paving the way to the aforementioned POST requests.

So what's in MetaCPAN::API right now?

This Week in MetaCPAN

Last week I posted an article on how CPAN authors could expand their profiles on metacpan.org. Since then there has been so much activity that I thought a quick recap would be in order. I'm not covering all activity, so my apologies to anyone whose efforts have not been replayed here.

At the time of the article, 91 authors had logged in to MetaCPAN and updated their profiles. That number after one week is 240. That's still a very small fraction of total CPAN authors, but it's also an amazing start.

On or just after the day of my post, Mo added +1 to metacpan.org. So, if you haven't already, log yourself in and start upvoting your favourite distributions. There will be more info on +1 to come, but this is a first step in making CPAN a friendlier place.

comp.lang.perl.announce was stalled, now fixed

The NNTP injection host that I use to feed comp.lang.perl.announce had moved, and for some reason I had hardwired the old IP address into my posting script. Once I got that sorted out, it looks like it'll be business as usual for CLPA once again.

YAPC::NA Needs Your Help

We need your help to make YAPC::NA the best it can be. First, we are trying to compile a list of every company and organization that uses Perl. Second, if there is someone you'd like to hear give a talk about anything submit them to our Presenter's brainstorm list.

XML::LibXML parse_html_string iframe games

Given HTML with certain "empty" tags that you wanted to manipulate via something like:


my $html = '<p><iframe src="..."></iframe></p>';
my $doc = XML::LibXML->new->parse_html_string($html);
# do stuff with $doc
$doc->toString();

You would end up with:

<p><iframe src="..."/></p>';

Namely, the "empty" iframe tag is going to get output as a single, self-closing tag.

But that's not valid HTML. Not even valid HTML5.

XML::LibXML::Parser has the setTagCompression option but this is no good here.

<hr/>, <br/> and <img src="..." alt="..."/>

cannot be written as:

<hr></hr>, <br></br> and <img src="..." alt="..."></img>

at least, not if you want valid HTML.

I hit upon the idea of appending a single space:

for ($root->findnodes('//iframe')) {
    $_->appendChild(XML::LibXML::Text->new(' '))
        if !$_->hasChildNodes;
}

which works, because an extra space inside a previously "empty" iframe, script or canvas tag would be harmless. However this approach will cause problems when you come across "empty" <textarea> tags.

<textarea></textarea>

is not the same as:

<textarea> </textarea>

Dist::Zilla::Plugin::EmailNotify and not releasing to CPAN

We've been using Dist::Zilla at $work quite some time now.

For a while I feared the possible mistake of running "dzil release" on one of our modules or applications (we have quite a bit!) and thus releasing it to CPAN. We try to remove all generic parts of our code and push it as regular modules on CPAN so everyone can enjoy it (and we get feedback and patches and so on). This means that the rest of our code, what we keep on local repositories, are very specific to us. This cannot be released, obviously.

First job was fixing that. Easy enough. In your dist.ini:

[@Filter]
-bundle = @Basic
-remove = UploadToCPAN

Now if someone tries to release, it fails. Yay!

Next one was a feature I wanted for a while: to be able to get notified by email when a new release it out. I've searched CPAN and could not find anything that emails. So I wrote Dist::Zilla::Plugin::EmailNotify.

App::UniqFiles (a case for building app with Dist::Zilla and Sub::Spec)

When watching videos at Tudou or Youku, both Chinese YouTube-like video sites, you'll often get one/two 15- or 30-second video ads at the beginning. Since I download lots of videos recently, my Opera browser cache contains a bunch of these video ads files, each usually ranging from around 500k to a little over 1MB. But there are also duplicates.

I thought I'd collect these ads, for learning Chinese, but I don't want the duplicates, only one file per different ad. The result: App::UniqFiles, which contains a command-line script called uniq-files. Now all I need to do is just type mkdir .save; mv `uniq-files *` .save/ and delete the duplicate videos, which are files not moved to .save/.

ACT being converted to Plack

Our software dev team for YAPC::NA 2012 has begun the task of converting the venerable ACT conference management system, used to run many YAPC's, to Plack. It is currently directly tied to the mod_perl 1.x API. This modernization effort should make ACT more accessible to more developers around the world. Our hope is that this work will be completed and released to GitHub in the next few weeks.

Notes on Morphing Graph::Easy into Graph::Easy::Marpa

Hi Folks

I've written an article on the considerations accounted for in the process of re-writing a module, here Graph::Easy being recast as Graph::Easy::Marpa.

It's a separate docuemnt (the output of pod2html) so I could preserve the formatting to my satisfaction.

Books and Ebooks: Renumerations on the Future

My GF recently published a book, The Girl in the Bunker, which has a ebook version and a physical version. This caused me to think about the future of books (also, given the fact that I will probably never get my thesis published as a monograph, I had cause to ponder). So my basic premise is that ebooks will be the larger market than physical books. The difference between the two will be that ebooks will be more like renting a book, see The Right To Read, while a physical book will be a true ownership position.

who cares about dependencies?

I used to worry, now, not so much. Here is my journey to less stress and worry.

Sometimes programmers have to develop applications for production environments that are less than ideal. By less than ideal I mean things like having a Perl version that was End of Life (EOL) December 16 2008, I am looking at you RHEL/CentOS 5.x. Add to that not being able to install CPAN modules or make other changes to the system. The setup I just described is far too common for developers (think shared hosting) and it is frustrating every time you run into it.

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.