Oh Well Back to the O'l Drawing Board

back_to_the_electronic_brain.jpg

Well that is the way I feel today, but at least, like Marvin, I am ready to start again. I tried in my last post to introduce a role into my D&D classes and all I ended up with what is what I started with, a muddle!

Well having another look at 'Intelligence', 'Characters' and 'Languages' I know that all 'Characters' have at least one language and they can learn more, the more 'intelligence' they have. So language ability is more of a trait of 'intelligence', rather than a role that intelligence fulfills. Hold on a 'trait' in Moose is just a role by another name so lets have a look?

Perl and Me, Part 3: A Møøse once bit my sister

This is part 3 of an ongoing series where I explore my relationship with Perl.  You may wish to begin at the beginning.

This week we look at the joys—and the frustrations—of Moose.

Last week I talked about why I believe that at least having the choice to program object-orientedly (without it being a huge pain in the ass) is vital to me as a programmer.  In the comments I also touched briefly on why I think OOP in Perl, pre-Moose, is a huge pain in the ass, but honestly I didn’t put much effort into making that point.  In my experience with other programmers (both in real life and online), the majority of them—perhaps 75%, at a rough guess—already agree with that and don’t need any convincing from me.  And the rest are most likely not going to be convinced no matter what I say.  Besides, this isn’t really a persuasive essay.  I’m not trying to change anyone’s mind.  It’s the story of my relationship with Perl.  And I, like most other coders I know, have placed some value in OOP, at least in some circumstances.  Also, I, like most other coders I know, felt that doing OOP in Perl was a bit of a chore.

Then we got Moose.

Installing The Whole Enchilada From Pinto

Several Pinto users have asked how to install all the modules in any given stack within their repository. At first, my response was to create a Task module that declared all the dependencies you need, and let your installer unwind the dependencies from there. Or better still, organize your app itself into a CPAN-style distribution with the dependencies declared in a META file, and then stick it into your Pinto repository.

But not everyone was thrilled about those ideas. Some folks just want to stash stuff in the repository and then say "install it all". And now you can! Read on to learn more...

make vs. make -j${TEST_JOBS}

Until the past year I never truly appreciated how much faster make will build an executable when you are running on some heavy iron and use the -j option. As a p5p committer I have a shell account on dromedary, a server donated by booking.com++ and maintained by Dennis Kaarsemaker and friends (more ++). On that box I set TEST_JOBS=8, which enables me to configure, build and test perl so fast that I have never bothered to time it (probably less than 5 minutes).

Today, however, was the first time that I learned that running make -j${TEST_JOBS} can obscure the results of make.

Rolless in Seattle

I left off from my last D&D post still looking for a role, but at least I settle on simple base class 'Ability' which I will extend into six abilities.

Now looking at each ability they all have differing effects depending on the value. So lets look at 'Intelligence' this time. According to the 'rules' it seems the more Intelligence you have the more languages your character can speak,as well for Magic User characters it betters the chances of your character learning a 'spell', sets higher the maximum and minimum number of spells they can learn per level and sets the highest level spell they can use. It even limits you on what race or class your character can take on. However, having high intelligence does not impart spell ability it only enhances it if you happen to be a MU. Likewise very low inelegance does not stop you from speaking at least one language.

So Intelligence is a set of modifiers
  • Additional Language Ability
  • Magic Ability
  • Character Class
  • Character Race

LPW2013 Survey Results

The 2013 London Perl Workshop Conference Survey results are now online.

Although percentage wise the submissions are up, the actual number of respondents are just slightly lower than previous years. Though it has to be said I'm still pleased to get roughly a third of attendees submitting survey responses. It might not give a completely accurate picture of the event, but hopefully we still get a decent flavour of it.

Marpa version of Perl6 Advent Calendar, Day 18

The Perl 6 Advent Calendar, Day 18, in addition to show perl6's builtin grammar facility, was adressing a fundamental aspect of text processing, i.e. native unicode support in a grammar.

Indeed, if we say text processing, we say also characters-oriented framework. The perl6 example was the occasion to test Marpa::R2, and produce a tiny tutorial with it.

A card is a face followed immediately by a suit.
Perl6's definition:
token face {:i <[2..9]> | 10 | j | q | k | a }
proto token suit {*}
    token suit:sym<♥>  {}
    token suit:sym<♦>  {}
    token suit:sym<♣>  {}
    token suit:sym<♠>  {}
UPDATE [23 december, 2013] character class version:
token face {:i <[2..9 jkqa]> | 10 }
token suit {<[♥♦♣♠]>}

Marpa::R2's definitions:

Maintaining possibly unused modules

My participation to the CPAN Once a Week contest forces me to find a module to create or update every week. And because I don't want to cheat, it has to be a meaningful change (I also try not to make a new Acme::MetaSyntactic release every week).

This week, I decided to look at my module list through the filter of CPAN Testers. [One of them was really not looking good]( http://matrix.cpantesters.org/?dist=WWW-Gazetteer-HeavensAbove%200.18)

Are Abilities Roles?

In my last post I started out modeling D&D characters with Moose to examine how roles could be applied

I ended with very little code written before I had to make a decision on using my first role or to use more traditional object extension.

Now, Looking at 'abilities' they all have the same set of common attributes, (I will just use a few)
  • name
  • initial value
  • current value

So to make this a class we would just do this

A simple perl recursion example

Have a test about what will happen if a script is calling to run it self when it is running:

#!/usr/bin/perl
use strict;
use warnings;

print "******\n";
perl $0;

The result will be kind of infinite recursion, keep printing out the * .

The 2013 White Camels


We used to give the White Camel Awards out at conferences because we knew the recipients would be in the audience. As we've become more inclusive with the rest of the globe, that didn't make sense. This year, we've waited until Perl's birthday to announce the awards.

The White Camel Awards recognize outstanding, non-technical achievement in Perl. Started in 1999 by Perl mongers and later merged with The Perl Foundation, the awards committee selects three names from a long list of worthy Perl volunteers to recognize hard work in Perl Community, Perl Conferences, and Perl User Groups.

This year we took nominations through Mob Rater. We developed a long list of worthy recipients.This year, the White Camels recognize the efforts of these people whose hard work has made Perl and the Perl community a better place:

Perl Community: Thiago Rondon

Success vs Failure: You Might Need A Different Perspective

Please bear with me. You need to hear a little bit of a story, before we can talk about success and failure.

When I was 19 years old, I started writing my first game, called deadEarth. It was an adventure role-playing game set in a post-apocalyptic wasteland filled with crazy mutants and tons of violence. Exactly the kind of thing a 19 year old college sophomore would be in to. It was cheesy, and I took myself way too seriously, but it was so much fun! The original manuscript was only 9 pages. Over the next several years, with the help of a bunch of friends, it became a 174 page book that I self-published. 

Out of the Barn Yard

As I am cozening up to Moose these days I wanted to play with Roles as one is suppose to be able to scurry around the Diamond problem with them, and having some background with Lisp and Smalltalk I knew of them.

Unfortunately like many many many other tutorial on OO we stayed firmly in the barnyard (well in moose's case a pet store ) which of course is fine if you are an animal lover but I am always modeling something that is a much more complex as the idea of a ' Role ' is much more abstracted and mulit-layed than differing animal noises as this little syllogism points out;
All dogs have a bark. But not all things that have a bark are dogs.
So what would be a good example of something that is complex, mulit-layered, and demonstrates, to me at least, how roles should work?

Well I looked over on my book shelf and this caught my eye;

PlayersHandbook8Cover.jpg

What does "my" really mean?

"The meaning of my $x is that you tell perl, and specifically to strict, that you would like to use a private variable called $x in the current scope. Without this, perl will look for a declaration in the upper scopes and if it cannot find a declaration anywhere it will give a compile-time error Global symbol requires explicit package name Every entry in a block, every call to a function, every iteration in a loop is a new world. "

Empty an existing variable:

$x = undef;
@a = ();
%h = ();

Source from: perlmaven

ADAMK::Release - Halfway between SVN and GitHub

When it comes to repository structure, my philosophy has always been that you should have as few files as possible with as little redundant information as possible, but all files that are in the repository should end up in the final tarball, and all content be identical to what ends up in the final tarball.

This is very different from Dist::Zilla, which has an extra config file and content that has POD with template content in it.

When you look after a few hundred modules, the less files you have to edit or save the better.

But I recognise this approach isn't for everyone, so I've never encouraged others to follow my practices, and I've never packaged my scripts up into a module. Until now.

As my modules move into GitHub they inherit this legacy of this minimal files approach, at least in the short term until I start changing over the distribution structure to a more conventional style.

What?! CUDA::Minimal... works?

I wrote CUDA::Minimal back in late 2010/early 2011 and used it in some of my research before defending my Ph. D. dissertation in May of 2011. At my postdoc I didn't use parallel anything, so CUDA::Minimal languished. When I picked it back up, it didn't even compile on a modern version of Perl. It was disheartening, to say the least.

But now, once again, it works (as long as you're not using Perl v5.16)!!!

Callbacks Ate my Brain!!

The DBI Issues List is not one that see allot of traffic but there are few of us out there that keep an eye on and a lurk around waiting to pounce on a good one.

Most are simple newbie errors or an obscure install problem but the odd one is a real bugger and they usually start or end with a line like this;

This has been running for years and and now it doesn't work!!!


There usually follows the obligatory;

'My manager wants an answer'

and or

'this never happens with PHP'

etc.

So Martin and I began the usual work up on a problem. In this case it was with DBD::Oracle, binding with ORA_VARCHAR@TABLE

Seems this

$sth->bind_param( ':in_sourceNames', $sourceNames, { ora_type => ORA_VARCHAR2_TABLE }

Died with this error

*19:05:57 ERROR: Caught an exception from DB: DBD::Oracle::st execute
failed: called with 3443804 bind variables when 7 are needed [for
Statement..."*

Most common build-in functions or operators beginners should know about Perl

if (defined $x)

check a value or variable is undef or not.

undef $x;

reset a variable to undef.

qq, double-q operator; q, single-q operator

print qq(The "name" is "$name"\n);
print qq(The (name) is "$name"\n);
print qq{The )name( is "$name"\n};
print q[The )name} is "$name"\n];

The result will be:

The "name" is "foo"
The (name) is "foo"
The )name( is "foo"
The )name} is "$name"\n

x is repetition operator.

say "2" x 4;

will print the result:

You Can't Test Everything, But At Least Test What's Important.

The key word being important. After releasing fetchware to CPAN, I got back CPAN Testers reports that had hundreds of given/when deprecation warnings. These warnings would just be completely insane when actually running the program on newer Perls, so given/when had to go byebye.

I used vim's cool but ancient s/// command to find and replace the givens and whens with their appropriate ifs. Unfortunately, I goofed up so profoundly that before bugs were reported to github, I had absolutely no idea that fetchware's command line interface was completely broken.

Moving PPI to GitHub encourages some new activity

With the increased number of module takeover requests I've been seeing in the second half of the year, I've been under increased pressure to put more serious efforts into moving my modules to GitHub.

Over the last few weeks I've been writing wrapper code around svn2git and doing some bulk conversion test runs on the 200 or so modules in my repository for which I am still the most recent distribution publisher.

After hand-labelling Git author emails for the 100ish users in my repository, the conversion process seems to run fairly well for modules which don't contain any branches (svn2git still seems to misbehave on my repo despite the use of --nobranches.

Before I start bulk creating GitHub repos, I'm testing the result of the conversion on a few important modules that have suffered the most pain from lack of releases.

The GitHub PPI repository in particular has seen immediate activity from new contributors following it's creation, with merge requests appearing within the first 24 hours.

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.