Chicago.PM - Dependency Injection (also: Beam::Wire)

At this month's Chicago.PM meeting, I gave a presentation on Dependency Injection and my new module, Beam::Wire.

[EDIT: The presentation doesn't appear to work on mobile devices. I'm trying deck.js, and I'm not sure I like it.]

Role::REST::Client and hash key randomization

Role::REST::Client is a small module to be used as a Moose role. It will enable your module to call REST services in a clean, transparent way. It was originally a part of Catalyst::Model::REST , and I guess that is still the main use case, but it can really be used in any module needing to call a REST service. To use it, all you have to do is

use Moose; 
with 'Role::REST::Client';

and you will be able to use ->get, ->post, and so on with Role::REST::Client handling the encoding, (de)serialization, etc of the call. Thanks to many contributions from Wallace Reis, Matt Phillips and Mark Stosberg it is very configurable and robust.

I've been getting error reports for some time, but a cursory glance through the code showed no faulty use of hashes. I've used all my ressources at $work, so I haven't had time to dig into this problem, until Сергей Романов (sergeyromanov) poked me with a pointy test case. The problem was easy to find, two parameters to ->new relying on their individual order.

Problem is fixed and uploaded to CPAN as Role::REST::Client 0.15

Bringing Old Modules Up To Modern Specification

While working on Pinto, I discovered that a fair number of distributions on CPAN have invalid or incomplete metadata. This makes it hard for the toolchain (Pinto especially) to fully utilize them.

Usually the offenses are pretty minor -- misspelled or missing keys in the META files, or a non-parsable version number. Some of us have probably made local patches of these distributions to fix those problems. But there's no reason everyone should have to do it.

So I had an idea -- what if there was a secondary public CPAN where folks could contribute patched versions of these older distributions? Read the rest of the story here:

https://github.com/Stratopan/Patchpan/blob/master/README.md

What does this PHP print?

Via this blog entry which I'm sure some of you have seen before, the following PHP prints "horse".

<?php
  $arg = 'T';                                                                                                                
  $vehicle = ( ( $arg == 'B' ) ? 'bus' :
               ( $arg == 'A' ) ? 'airplane' :
               ( $arg == 'T' ) ? 'train' :
               ( $arg == 'C' ) ? 'car' :
               ( $arg == 'H' ) ? 'horse' :
               'feet' );
  echo $vehicle;
?>

No fun shooting fish (or a horse) in a barrel, but wow. Just wow.

A Case for Tie::Array::CSV

What is the favorite module you have released to CPAN? For me, its not some shiny CMS or fancy scientific simulation. In fact, mine is probably horribly inefficient, maybe even a little evil, but I like this one best because it is clever.

Today I used my favorite of my modules in order to accomplish a difficult task, and in doing so I found a little bug, which I have just fixed. Which one is it? Let me introduce you to Tie::Array::CSV.

Cluj.pm Anniversary Meeting Report

So, I went to Cluj.pm's anniversary meeting this month. It's been a year since Cluj.pm was formed and I've been lucky enough to be invited to the event. Here's my report of it.

Code Pornography

Ok, that title is a bit of a teaser. But I do think that code should be sexy. In this full-color high-definition world, we've come to expect things to actually look attractive.

I'd love to see pretty logos or icons for each module on MetaCPAN. Perhaps we could add a new attribute to the META spec that points to an image file inside the distribution, or a URL somewhere.

Citations in the Humanities

I have written a few articles and more than a few essays for school/class. I know most of the major citations styles (MHRA, MLA, Chicago, etc.). Mostly, however, I use biblatex to format them all. However, I have begun to think that most of these citation styles are really just pointers to other resources or more generally they are really just URLs with a arcane special formatting rules. Many academics are obsessed with these bits of meta-data as they validate that the writer knows the rules of the road. When I read academic articles or books, I generally don’t notice or skip over citations as, while they are necessary and useful, they don’t always help with digestion of the actual argument. Although, occasionally in fields I know well, I will scan the citation to see who they are referencing just for credibility purposes.

Chef cookbook for plenv

plenv is so cool that I'd like to use it for my personal project. Then, I have to hack up chef cookbooks for automated provisioning. I tried to write Chef LWRPs for the first time.

Using the cookbook, you can easily install perls via plenv and CPAN modules via cpanm.

I'm waiting for your feedback.

Usage

Using Attributes and Recipes

Add these recipes below into run_list:

recipe[plenv]
recipe[plenv::install]
recipe[plenv::global]
recipe[plenv::cpanm]

Then set attributes described later.

Using LWRPs (Recommended)

Only recipe[plenv] should be added into your run_list.

recipe[plenv]

Then use LWRPs in your own recipe.

Mobrater and White Camel Nominations

I'm looking for nominations for the 2013 White Camel Awards, and this year I'm using MobRater, a PlainBlack service, to get those nominations at http://whitecamelawards.mobrater.com.We're looking for people who have made significant non-technical contributions to Perl and the Perl community. We typically divide that up into user groups, community, and advocacy, although the categories are a bit squishy.

Us using MobRater doesn't mean that the most voted nomination will get the award, but the committee will certainly take that into account. There might be a great nomination that comes in at the end and doesn't get that many votes. To help get around that, check back sometime to vote on the new people added.

You can vote on the names there and also add your own. I'm really looking for new names, especially in the communities that might not overlap that well with the US and European communities that I knew much better. So far, we've had no one from India or Africa receive an award, and we've had very few recipients from Asia and South America. There might be people doing great things for their local communities that don't get much press far away.

Fat Versus Thin Core

I used to feel the Perl core should be as small as possible. That is, it should ship with the smallest number of modules whilst still being "practical". For everything else, there is CPAN.

So naturally, I was pretty pleased when I heard that CGI and some other modules were going to be removed from the core in perl 5.20. But lately, I've started to change my view on that. Here is why...

Encouraging bloggers to use the 'extended' feature

This is a collection of ideas for how we can encourage bloggers using blogs.perl.org to split their posts into an abstract and body. Attempts at education have largely failed, so I think we should try something else.

App::Midgen, Take two

First I would like to say a big Thank You for all the critiques I received, here and in the channels.

App::Midgen

Food for thought, if we update our Modules, don't we want our users to use the current version, so should we not by default do the same with others Modules. Thus we always show the current version number, regardless.

Now able to show dual-life modules current version number.

Lets start with the changes and inspiration.

  • Switched to using MetaCPAN-API due to a write issue with CPAN, neilb++

  • Switched to using Perl-PrereqScanner to do most of the grunt work as pointed out by Mithaldu++ daxim++

  • spelling, re-factor option names, inspired by mauke++

    • --format change output format
  • changed default output, no extra processing, only distribution version for modules without a version number mst++

if I missed anybody, sorry

And some new features.

Add command line option to show dual-line module versions as well.

midgen --dual_life

Add ability to read/write options from ~/.midgenrc

Back in the #!perl groove ...

I've taken a lot of time off from the work force (and even more from the community). I have been occupying my time with pursuing other ventures (my other brand), but now I find myself actively desiring to write code.

So i began by refreshing and slightly expanding the "jeffa/unlocalhost" brand and ensuring all was available and secured. Next I grabbed the small amount of old code from my CPAN repository and rebuilt each distribution using Module::Starter. Not only did i upload each distribution to github, i also set up Jenkins on my server and set up a job for each one. Each Jenkins job clones a read-only copy, builds the make file, runs the tests (and creates JUnit output for Jenkins) and builds a tardist upon success.

Awesome. Not a bad first step if i do say so myself. And in the process of setting this up i was already able to correct some Pod::Coverage infractions. Next step will be to write proper tests for each of these distros but i am not going to spend too much more time on them. If others wish to fix bugs or otherwise enhance the code they now have a much cooler way to submit patches.

Bigger fish to fry ahead ... >:)

FLOSS Weekly Interview on Pinto

My FLOSS Weekly interview on Pinto is now online here:

http://twit.tv/show/floss-weekly/246

Big thanks to Randal Schwartz and Aaron Newcomb for having me on the show!

Gtk3::WebKit on Ubuntu

After some really fantastic help & support from potyl I got Gtk3::WebKit to pass it's installation tests on Ubuntu 12.04 (precise, LTS).

Given that this requires one step that cpan/cpanm won't deal with out of the box, in the interests of documenting for the interwebs ...

Dependencies ... at least on Ubuntu 12.04:

aptitude install xvfb libgirepository1.0-dev pkg-config libgtk-3-dev libglib2.0-dev libglib2.0-0 gir1.2-webkit-3.0

Gtk3::WebKit isn't intended to run "headless", which might be one response to the comments on Web Scraping with Perl & PhantomJS about why you'd want to use PhantomJS instead.

However, having been enlighted by potyl, you CAN run it sorta pseudo headless, by using framebuffer display. And thus, no X server is required.

But this is the bit that's going to throw cpanm and naive installs off. Here's the voodoo that you do:

xvfb-run --server-args="-screen 0 1024x768x24" cpanm Gtk3::WebKit

or, if you're doing it old school

Comparing Apples and Oranges - rubygems vs cpan part 2

In part 1 I looked at numbers, now I want to look at uploading and the uploads themselves.

Uploading to rubygems is very simple, I don't know or use ruby, but just from looking at the frontpage I'm pretty confident that it would be pretty quick and easy : 1/2 of the main content of the page is a quickstart guide in 3 simple steps. Neat! (I'm sure there is more to writing a good gem, but that definately leaves you feeling confident to give it a go).

Uploading to cpan via PAUSE is something I do a couple of times a week without really thinking about it, that doesn't mean it's easy, it's pretty much muscle memory after a decade of doing it.

However, from the perspective of somebody outside the "echo chamber" (as I most certainly was when I looked at the rubygems site), it's very different when you arrive at the cpan.org site.

XML-Grammar-Screenplay: Alternative Format for Hollywood Screenplays

A short time after I posted a message about XML-Grammar-Screenplay to a Perl forum, a Perl enthusiast sent me a message reading like that:

I would think that a proper screenplay grammar would be useful (I've thought of writing one myself). Though I've looked through your screenplay examples, I can't see any of them, anywhere, which is actually rendered in correct screenplay format (example), nor anything which appears to directly support the special directives often found in screenplays, such as sluglines. Am I missing something?

(Poor) Directions for formatting a screenplay are here. That really doesn't cover the *extremely* rigid formatting rules involved (a reader can often toss a script with bad margins and get paid for it anyway).

Screenplay-Text looks something like this:

Notes from a Newbie 12: Create and View Comments

Notes from a Newbie document the creation and deployment of yardbirdfanclub.org with Perl Catalyst on shared hosting. They are intended for a Perl Catalyst Newbie who would like to study the creation and deployment of a simple Perl Catalyst application.

PDL 2.006 released!

On behalf of the PDL Porters, and especially our tireless leader Chris Marshall, I am very happy to share the news that PDL 2.006 has been released, I’m reposting the announcement here, find the full message including release notes on the mailing list. It even includes my first contributions to the PDL core :-) Enjoy!


The PDL development team is pleased to announce the official release of PDL-2.006 and an updated draft of the PDL Book to accompany its release.

Of specific note:

  • PDL VERSION numbers now use single decimal format. This will be the standard going forward.

  • PDL now has three graphics options that build on all supported PDL platforms (thanks to work by Craig DeForest and David Mertens and a host of others):

    and

    • PDL::Graphics::Simple a basic 2-D graphics layer that can use many of the existing PDL graphics modules with a uniform syntax.
  • ASPerl build issues have been resolved thanks to relentless testing, verification and fixes by Rob/sisyphus and other win32 PDL users.

As always, go to http://pdl.perl.org for information about all things PDL and how to get PDL for your platform.

Enjoy!

Chris Marshall

PDL-2.006 Release Manager

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.