Musing on Perl::Critic config

I've been exploring the Perl::Critic configuration file somewhat, and something struck me as unusual.

It seems fine for using for the usecase of "inherit some predefined set of rules and apply them selectively", which works fine if you just want to adopt some other standard that is pre-existing, and just make minor adjustments.

However, if you're wanting to create policy sets for others to use, it seems poorly suited.

1. Existing Systems

1.1. Severity level

This feature seems confusing.

It looks simple at first, but its problematic for anyone to utilise this to create a large, custom policy set.

The gist I get of reading it is you specify a severity level in your configuration, and policies that are included with a larger severity number than that are used. ie: Specify severity = 2 and items with severity levels 2,3,4,5, will be applied, while rules with severity level 1 are ignored.

The documentations suggest it might be a good idea to manually override the severity level for a plugin, ie:

Perlybook on 24pullrequests.com

I added perlybook.org to 24pullrequests.com. Hopefully we get some pull requests to iron out the issues we have.

Another related project I added is EPublisher-Source-Plugin-PodFromGithub. When we have finished that plugin we would be able to convert stuff like the Perl Advent Calender articles into ebook formats.

Due to private reasons I wasn't able to finish that plugin before December started :-(

Have you added your Perl project to 24pullrequests.com?

24pullrequests.com takes the spirit of the Advent coding calendar and puts a new spin on it. Try to send one pull request per day for the next 24 days and 24pullrequests.com will help you track your progress. At the time of writing, 1,224 devs have already signed up.

Some Perl projects are already represented, but there's still room for more. It would be good to see some more Perl projects on the list for participating Perl devs who are looking for something to contribute to.

Documentation for Fun and Profit

Last week at the London Perl Workshop, I gave my first ever talk. 20 minutes on the subject of documentation. I'm pleased to say it went very well, and I've had some fantastic feedback from everyone who saw it.

I thought the wider perl community would appreciate having a look at my slides. As always, it would make more sense to hear me talking - but this gives a good idea as to what the talk is about.

If anyone wants to invite me to speak at exotic locations around the world, I am available ;)

Documentation for Fun and Profit

Dancer GitHub repository move

The Dancer repository on GitHub has been moved, from Sukria's own GitHub account to live under the PerlDancer organisation on GitHub.

This has been done to better share administration duties between the core dev team, and enable commit bits to be distributed more easily where needed.

However, this does mean that the old repository URL will no longer work - the repository is now found at:

https://github.com/PerlDancer/Dancer

If you have a checkout of the Dancer repository, you'll need to tell git about the new upstream URL - if you had a commit bit, so had a read+write checkout:

git remote set-url origin git@github.com:PerlDancer/Dancer.git

Otherwise, e.g.:

git remote set-url origin git://github.com/PerlDancer/Dancer.git

If you have a fork of the Dancer repository, similarly you will need to change the upstream location:

git remote set-url upstream git://github.com/PerlDancer/Dancer.git

The Dancer project website will be updated shortly to link to the new repository.

Recently while developing...

...some new stuff for perlybook.org I got an error message and needed quite long to find the cause. This was so unexpected too, because I have not done much changes.

The error message I got:

Unrecognized character \xCD; marked by <-- HERE after og->debug(<-- HERE near column 26 at script/../lib/PodBook.pm line 43.

Here is the code:

hard_to_find_error.png

Who finds the error first?
Ps: dusty screens will make it harder!

Greetings
Boris Däppen

Sequences, Sets, Bags, Functions

Groups of Items

A sequence is an ordered list of items, whose items aren't necessarily unique. Perl's arrays are sequences of a finite size:

my @sequence = qw/bar baz ban baz baz/;

A set, however, is an unordered collection of unique items. Perl provides native support for sets in the form of the keys of hashes:

my %set1 = map { $_ => undef } qw/foo bar baz/;
my %set2 = map { $_ => undef } qw/bar foo foo baz/; # Same as above
my %set3 = map { $_ => undef } qw/baz baz bar bar foo foo/; # Also same as above

Because sets are unordered, and contain unique items, the sets formed by the keys of the hashes above are identical. Generally sets are used to test for membership:

my %acceptable = map { $_ => undef } qw/foo bar baz/;
die unless exists $acceptable{ $key };

Set::Scalar provides further useful set operations.

Head Gestures in browser based game

Recently I stumbled upon WebRTC. I started looking into this and found some useful libraries on github .

I have been creating some games in Javascript so thought why not use one of these libraries to use some gestures to play a game .

Alien::Base Grant Report November

This month featured lots of work in the latter parts of Alien::Base. These improve library detection logic, pkg-config functionality and packlist support.

I was especially pleased to get a bug report filed by bpo regular Toby Inkster. He is writing a provisional Alien::LibXML based on Alien::Base. He noticed some odd behaviors that we are still trying to work out. This feedback led to more improvements than just his, so please keep the bug reports coming!

This month I released three dev versions, the latest being released this evening. I also released Acme::Ford::Prefect again, this time the tests shouldn’t fail on CPANtesters computers who don’t actually install the dependent modules for the one that they are testing. This module is one of the “downstream” modules that are part of the test system for Alien::Base (along with Acme::Alien::DontPanic). These are needed since some of the magic happens during the final installation so tests have to occur AFTER installation of the module in question.

How to use SOAP::Transport::HTTP::Plack

I needed to port a little cgi-script that implements a simple SOAP-server to Plack. After a little searching, I came across SOAP::Transport::HTTP::Plack.

Unfortunately, the documentation of this module is ... not really helpful.

Here's my (slightly modified) cgi-script:

#!/usr/bin/perl

use SOAP::Transport::HTTP;

SOAP::Transport::HTTP::CGI
    ->dispatch_to(
        '/some/directory', 
        'Some::SOAP::Module1', 
        'Some::SOAP::Module2',
    )->handle;

Simple enough.

De Morgan's laws in Perl

We've been simplifying some ugly code recently, and De Morgan's laws have come up more than once. A developer on the team complained the Wikipedia entry obscured - from a developer's perspective - the simplicity of these quite useful transformation rules, so, expressed in Perl:

Given $p and $q as truth values:

(! ( $p && $q ) ) == ( (! $p) || (! $q) )
(! ( $p || $q ) ) == ( (! $p) && (! $q) )

OR:

NOT( p AND q ) is equivalent to (NOT p) OR  (NOT q)
NOT( p OR  q ) is equivalent to (NOT p) AND (NOT q)

So for example, say you come across a beauty like:

foo() unless (! $bar) or $baz;

You can use De Morgan's to translate it to:

foo() if $bar and (! $baz);

Wikipedia entry: De Morgan's laws

A font just for sarcasm - gotta love it

Hi

Yes, it's true:

Click to behold.

Cheers

Open source motivation survey

Hi!

Please fill this Perl community motivation survey.

It's short and shouldn't take more than 2-3 minutes of your time.
If you ever shared your software, commited a patch, reported a bug or wrote a blog post on Perl, your opinion matters.

The reasoning behind this survey:
For the Play Perl project to succeed, I need to figure out if there's a demand for this product, and which features will be more important. I've already spent a considerable amount of time thinking about it, and I'll share my ideas about why I'm doing what I'm doing after the survey will be over.

Of course I'm also going to share the aggregated results of this survey for everyone to meditate on.

By the way, Wufoo doesn't allow free accounts for users from my country, so I spent $15 on it. I guess I'm motivated enough :)
So I hope we'll get enough answers, and PLZ RT.

Using Perl's Catalyst/HTML::FormHandler integration with Bootstrap and JQuery

dpetrov (Dimitar Petrov) has forked, improved and now hosted the HTML::FormHandler demo/example app on dotcloud, and it looks rather nice!

You can explore the demo at http://formhandler-perl.dotcloud.com/ and see the sourcecode behind it at https://github.com/dpetrov/formhandler-example

Fun things he's added are some table ordering, labelling required fields, and integrating jquery validation (via my plugin for HTML::FormHandler)

Writing State Monads in Ocaml

One of my projects for quite a while is to understand Monads. I have been working on this, off and on, for an embarrassing amount of time. Yes, I could have just learned Haskell and that would have done it but I wanted to be a pain in the arse. Also, I had a horrible experience attempting to learn Haskell a long time ago. Thus, I decided as I use Ocaml for most things then I should be able to do it. First, I read this article a few times and this which is really good and helps hugely in my understanding. Anyway, I will take a step by step approach to showing how to write a State Monad for Ocaml.

A Look at Recursion

I created a blog about Perl over on Blogger and I have just posted an new article on recursion.

Categorizing CPAN modules

Warning: no polished content ahead (as if my writing is polished?) It's all brain dump.

CPAN has categories, but it has long been unmaintained and not very deep/specific: http://www.cpan.org/modules/by-category/

Should there be a new category/dmoz-like-directory project?

Creating tasks like Task::Topic::DataValidation or Task::{BeLike::SHARYANTO,}::Topic::{DataValidation,Logging,...}? Cute? Maintenance nightmare? Pointless? Probably all of them.

Should CPAN META contain tags, to let authors categorize themselves? Since nowadays the trend is using cute Ruby/Python/npm style for modules, and thus the module name themselves are not indicative of the modules' nature.

Should metacpan or other project let people crowdsource this? People can already comment/rate modules and star/favorite them. Adding tags is just one more "social stuff" to do.

Selenium WebDriver with automated Basic Auth credentials

Selenium is a marvelous library for automating browsers. Perl has an interface via Selenium::Remote::Driver. A short script looks like:


use Selenium::Remote::Driver;

my $driver = new Selenium::Remote::Driver;
$driver->get(‘http://www.google.com’);
print $driver->get_title();

$driver->quit();

Under the assumption that a selenium server is found, this will launch google and print the title. It works very well for a lot of scenarios. One scenario where it has trouble is with Basic Auth and credentials. The browser usually outputs a popup requiring user-input.

Google Refine + Perl

(repost from http://sysd.org/google-refine-perl-english/; it's more contextual here)

Google Refine is awesome. If you're unaware of what it is, access their official page and watch at least the first screencast. You'll see it can be helpful for several ETL-related tasks.

Currently, I use it a lot, specially for simple (but boring) tasks, like loading a CSV, trimming out some outliers and saving as JSON to be imported into MongoDB. Nothing a Perl one-liner couldn't do.

However, the opposite is not true: Perl one-liners are a lot more flexible than Google Refine. Now, what if we could merge both?

YAPC::Europe 2013 in Kiev, week minus 38. In Kiev as a tourist

Not too many news about the conference today, although I made a visit to Kiev as a bare tourist (well, actually, as a fan of one of the actors) and this note is about that.

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.