CPAN Day is 16th August

Well this is a bit embarrassing. My script to tell me the date of the first CPAN/PAUSE upload told me the 16th August, but somehow when writing the first post about it, I changed the date to the 14th. Doh.

The good news is that 16th August is a Saturday this year, which gives us all a better chance at uploading a release or two. And two more days to prepare.

I've updated the previous posts, and regenerated the charts.

Method Privacy in Perl

This is a slightly expanded version of a comment I posted a couple of days ago on NEILB's blog.

Neil was mostly talking about private functions, while I'll be talking mostly about private methods (i.e. object-oriented programming), but I think there's probably a good deal of overlap between the two concepts.

The traditional way of indicating a method is private is to name it with a leading underscore:

   sub _secret_sauce {
      my $self = shift;
      ...;
   }
   
   $self->_secret_sauce(@args);

The assumption is even baked into the Perl development and testing toolchain in a few places. For example Pod::Coverage won't complain about missing documentation for a sub if that sub happens to be named with a leading underscore.

I used to think the underscore convention was good enough. But partly because of this upcoming project and partly because of problems I've encountered working on various codebases, I've been forced to re-evaluate my thinking, and have come to the conclusion that the underscore convention is insufficient.

perlbrew on OSX

I’ve tried and failed so many times to use perlbrew on OSX.

I’ll admit that I haven’t started a full-on investigation, but this is really quite frustrating and confusing:

Need IO::Pty help with *BSD/OSX

Recently I encountered an issue with Expect.pm on OSX. I think it is caused by a bug in IO::Pty (Expect.pm is a subclass of IO::Pty) and thus filed a bug report there . I even created a test-case and released an unofficial version of Expect.pm with a test exposing the problem.

Today, thanks to the countless CPAN smokers of BinGOs (aka Chris Williams) I got the first test reports that indicate the same problem exists on OpenBSD and NetBSD as well. (Surprisingly, there are no reports at all on FreeBSD and OSX!)

As I don't have any knowledge of BSDs and this IO::Pty stuff, I wonder if there is anyone out there with such expertise? Could you look into this issue?

Give your module a good SEE ALSO section

The SEE ALSO section in your module's pod is where you direct the reader to other things of interest. In this post I'll briefly outline what constitutes a good SEE ALSO, and why it benefits you to create one.

My thoughts on this topic have evolved over time, and in writing this I've realised that a lot of my modules could do with a brush up. I'll be releasing those on CPAN Day, of course :-)

Birds of a Feather (BoF) Meetings

Birds of a feather... flock together.

YAPC::EU is a great place to meet face to face with others in the community that share your interests, even non-Perl ones. To make it easier for you organise these informal gatherings - known as BoFs - we have created a page on the wiki.

Fancy getting together to watch the premier of the new season of Dr Who, going for a run, or discussing the future of Act (A Conference Toolkit? Then sign-up now!

If none of the current BoFs interest you then please feel free to make your own suggestions for a meet-up on the wiki and help us make the conference even better.

using Race::Condition to help track/test, well, race conditions ...

Knock Knock. Race::Condition. Who’s there?

Race conditions are a fact of life. What can we do when one knocks upon our door?

Often we mark race conditions that are not immediately solvable with a comment:

if (!-l $config && -f _ && -r _) {
    # RACE! config file could go away, change type, or become unreadable between file test and file read
    open my $fh, '<', $config …
    …

That is good so that future us can be easily reminded of the issue. It is really hard/impossible to debug or test the various possible race conditions though.

Race::Condition gives us a way to still mark the race condition but also adds in the ability to hook into it for debugging or testing purposes.

Does anybody know Matthias Nutt?

Once in a while, I search the web for Perl/Tk. I'm always happy to find some old jewels. This time, it was keen little rabbit ears, which is a simple ear training program for Linux and Windows. It has a Perl/Tk GUI and comes with good installation instructions.

You can find it here: Keen little rabbit ears.

keenlittlerabitears.PNG

I downloaded the script, got the dependencies (it relies on timidity to play MIDI files) and tried it out. Then I did some changes, like use FindBin to locate files relatively to the script in the file system, use File::Spec to build paths, and use File::Temp to create the temporary MIDI file for timidity in a proper place.

But, then I wanted to share the code with Matthias Nutt, the original author. He has a web site: matthias-nutt.no-limit.de. But the feedback form is dead (have a look at the anti-spam picture).

So, does anybody know Matthias Nutt? Or: does anybody know how to handle this kind of code? Can I set up a git repo with the new code without risking expensive lawsuits?

Give your modules a good SYNOPSIS

If the abstract for your module is up to snuff, then have a look at the SYNOPSIS to see whether you could improve that in a CPAN Day release. The SYNOPSIS should briefly show typical usage of the headline features of your module.

Here are some guidelines for a good SYNOPSIS:

(?P<NAME>...) vs (?<NAME>...)

Most Perl programmers using named captures in regex probably pick the (?<NAME>...) syntax, as that's what's displayed more prominently in the Perl documentation and tutorials.

However, Python does not support this syntax and uses (?P<NAME>...) instead (notice the extra P character). Incidentally, visual regex tool like kiki is built with Python and only support this syntax.

(?P<NAME>...) is also supported by Perl. So if you work with Python or use kiki, you might, like me, want to accustom yourself to using the P syntax.

PCRE (and thus PHP and other PCRE-using languages) supports both syntax. Komodo IDE's Rx toolkit support both. However, Ruby and .NET only support the non-P syntax. Well, that's how the real world works.

Let's top git.io

So, very recently the excellent Vastyn (Henry Van Styn) pointed out that we should be at the top of git.io:

" I came across our very own Kent Fredric’s GitHub profile today and did a double-take when I read his contrib stats:

https://github.com/kentfredric
# "Year of contributions: 21,996 total

Without even speculating by what kind of dedication/witchcraft this number is even possible, it made me curious about stats in general for GitHub, and some googling turned up this page:

http://git.io/top

This is a report of the “Most Active” 256 GitHub users. Well, not quite… The current number 1 on the list has HALF the contribs (kevinsawicki at “11,430”).

kentfredric doesn’t show up because of this second caveat: "Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search.

Broken LWP in the wild

I have app which do some stuff via HTTP/HTTPS. Here it is, already posted about it on blogs.perl.org

There is simple logic:

1) Use http. If user wants https, use https but check that LWP version >= 6 AND LWP::UserAgent->is_protocol_supported("https")
2) Retry HTTP 500 server errors. There can be a lot (coming from server, it's normal)
3) Retry HTTP 500 errors with Client-Warning=Internal response (LWP could raise this in case of conenction problem and socket timeout) with warning "connection problem"

So now I got two reports at once that everything completely broken and HTTPS does not work.

After some investigation I found that:

LWP 6.00 and 6.01:

1) ship LWP::Protocol::https as part of LWP::UserAgent distr, not a separate dist.
2) Do not ship and depend on Mozilla::CA. Instead there is note in docs:

Give your modules a good abstract

If you're looking for something to release on CPAN day, check the abstract for your modules, and make sure they have a good abstract. The abstract should not only be compliant pod, but should succinctly describe what your module does. The name and abstract are often the first thing that potential users see, so make them count.

Conference Schedule

We are very proud and delighted to announce the conference schedule!

http://act.yapc.eu/ye2014/schedule

We've tried our hardest to balance the wealth of topics that our lovely speakers have proposed. But please let us know if you notice any issues with scheduling, as we will be fine-tuning this over the next weeks.

Dezi::App completes Doozi release

The final dependency for Dezi has been released as Dezi::App on CPAN. In addition Search::OpenSearch::Engine::Lucy 0.400 has been released which supports Dezi::App.

Read more about it on the Dezi site.

Easily add tab completion feature to your CLI program using Getopt::Long::Complete

There are several modules to help you create command-line program with tab completion feature, including Getopt::Complete and Perinci::CmdLine (and its new lightweight alternative Perinci::CmdLine::Lite. Now here's another one. Introducing Getopt::Long::Complete.

This module is a drop-in replacement for the venerable Getopt::Long. Most of the time, you should be able to take your existing script which uses Getopt::Long, replace the use statement use Getopt::Long; with use Getopt::Long::Complete and suddenly your script supports tab completion.

For more details, see the module's POD.

The ghost of CPAN Days past

How many releases were done on previous CPAN Days? I know you've been dying to find out, so here are a few graphs, and I'll also compare with the top days in CPAN history. If 100 people each do one release on this coming CPAN Day (16th August, UTC), then it'd be the best CPAN Day yet. If between us we manager 151 releases, that would be the highest day ever.

CPAN and PAUSE record their timestamps in UTC, as all sane systems do. So if you're planning to release on CPAN, please take that into consideration.

One Month To Go!

There’s only one month left until YAPC::Europe 2014. The conference takes place on the 22nd - 24th of August in Sofia, Bulgaria.

We’ve done our best to keep the cost of the conference low and if you still haven’t bought a ticket - don’t delay, buy it today!

  • Regular price 99 EUR
  • Student price 60 EUR
  • Business price 500 EUR

Bulgaria, Romania, Macedonia, Serbia and Baltic states(proof of citizenship is required)

  • Regular price 60 EUR
  • Student price 35 EUR (student card is required)

Once you’ve bought your ticket remember to take a look at the scheduled talks and “star” the ones you’re planning on attending. The finalised schedule will be ready by the 1st August.

Looking forward to seeing you in Sofia!

A quick and very dirty pastebot.

I started a new job. One that requires me to leave the house on a regular basis. And talk to people in the day time, in person. In fact I'm finding it not much different to normal. It seems that instant message is the first line of communication, and people will come and talk to you if you have mutual cycles available at the time. Plus there's a contingent of remote staff, so IM is still important.

When you have IM communication between programmers, you need a pastebin as well. The new guys are using bitbucket that doesn't have that facility, and I wasn't happy with suggesting using a public pastebot. So here's something that does the job. I don't think it's ideal but it achieves 90% of the job in a tiny amount of time.

How to create an installable web application with config/data/bin stuff?

I'm writing a Dancer2 web application which contains configuration (config.yml, development.yml, production.yml, and-so-on.xml), application data (js, css, templates) and application binary (Perl bootstrapper, Perl tools) parts.

Usualy a web distribution is installed via extracting a ZIP file and there you have your e.g. /public, /environments, /lib and /bin. You start your web application with perl ./bin/app.pl or similar.

What I currently think about is to actual install a Dancer2 web application like normal (linux/unix) applications would do. So /public would end up at /usr/share/mydist/public, /views would be /usr/share/mydist/views, /environments including /config.yml are located at /etc/mydist/environments and /etc/mydist/config.yml. /logs moved to /var/log/mydist and /lib is system wide installed like you install a normal dist with cpan. Scripts in /bin would "installed" to /usr/bin

Assuming I use Dist::Zilla to create dists how could I achieve this?

I remember there was a previous discussion about installing web application with CPAN but I can't find it anymore. Neither - IIRC - was the discussion concluded.

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.