On the Correct Path Again

Well back to Perl posting today. You might remember a very bad thing I did in my last post namely altering an installed module and thus breaking any chance of portability or at least maintainability of my current project.

Well the old story of short term expedience for long term failure is fine for the next few days but I really do need a better solution so in the end I will have to write some of my own code.

Well I was thinking of just writing a different version of 'MooseX-AuthorizedMethods' unfortunately this was not as easy as I first thought. Seems the above Mod the way it was designed sort of hogs the 'Method::Authorized' namespace as I do not see anyway I could add my own 'Method::Authorized' package without either clobbering the original or rewriting it to be more namespace friendly.

So what to do??

CPANdeps pass/fail display now working again

Some months ago the way that third parties got access to the CPAN-testers results database changed. Instead of just downloading a SQLite database, there is now an API. This is good. It means that to get all the new reports since your last query, for example, you only need to transfer a few reports across the network instead of downloading all 40 million-odd records every time.

The change was well-publicised in advance, with a fairly long deprecation cycle. But I just never had the tuits to make the changes I needed, and so eventually that part of CPANdeps just stopped updating. It was still reporting dependencies OK, but didn't have any pass/fail data after a particular date.

Well, I'm pleased to say that it's back. Most of the work was actually done by Andreas König, whose script I am using as a shim to import data into the database that the rest of my code expects. I've also made a few other tiny changes which most of you won't notice, and also made the scripts that build the site rather more efficient so that they won't hammer search.cpan.org so hard when populating the site's metadata cache.

Next on my to-do list is to make the same fix to cpXXXan.

Github cheat sheet

https://github.com/tiimgreen/github-cheat-sheet

Perl-Operated Boy

And now for something completely different.

Some days Don't Pay

Well No perl stuff today as I have spend the last 24 hours almost fully diconeccted for the real word.

My phone line died 100% just a buzz coming down the line. I checked my DSL which is supposed to separate and it was down as well so a call out to Ma-Bell and the standard

A technicia will call sometime today between 08:00 and 17:00. So up early off to my local coffee shop to work for the day till they guy calls to come and fix whatever.

Well after 1 hour and 3 coffees I was asked to leave and off to the local McDs where after 30min and two coffees I was kicked off thier wi-fi. So back home a wait at least I got a few emails out and a little work done.

Adopting DateTime::Format::Mail

Finally pushing my first release of this distribution is a special moment to me.

Its original author, Iain Truskett (SPOON), died on December 29th, 2003. He was 24. Back then, I didn't know him, had never interacted with him, or even used any of his modules. That was ten years ago.

Improving the grant program (1) Grant Limit

Last year, Alberto, who ran the Grants Committee at that time, published this blog article to ask what we can do better. I read the comments repeatedly to think about our improvement options. In the next few entries, I will discuss what we did and what we will do to make the grants program more useful.

The first one is the removal of $3,000 limit (see #2 of the announcement).

From the comments made at Alberto's article:

I think the grant limit is an issue. I have projects I could submit, but I think they'd take too much of my time, and $3,000 just wouldn't cover it. Basically, I think I'd need to be able to take weeks or a months off of my job to get done what I'd like to do.

A smaller issue is the grant size - I did not have in mind grand plans like autarch, but I can easily see this being a month of work. $3k/month is rather limited.

Questioning the Role of API Design in Perl

or Querying the Designated API of Perl Roles

Well Why Not!

A question I relly have to ask myself more often. Well today I really got tired of my little solution to yesterdays Moose woes. I just couldn't take the sight of all of these

 
authorized bin_swap =>  [qw(Product::BRULE::Bin ], sub {
...
},(verifier=>Product::BRULE::Authorize->new())

instance calls in my nice clean code base. I did try a few little changes such as a global variable uck, and a singleton not bad but in the end I bit the bullet and decided that I need to add in some code of my own under MooseX.

The main reason is I liked how this worked and in a very elegant solution to to my code-base that can essilly extended with only a minor code change to a few roles if need be.

Perl Encryption Primer

Timm Murray gave his Perl Encryption Primer talk last night at MadMongers. He’s been blogging about it for the past month. The posts are quite informative so you should check them out. There’s also a video up on YouTube about it now.

[From my blog.]

The everywhere trick

After reading Eric's Plack blog series today, I also stumbled upon his other blog post about a nice little Devel::Dwarn trick.

I also pepper use Data::Dump; dd $something; in my code a lot! So many that I created DD and DDC to lessen the typing. But this trick is better because I don't have to put the use statement at all. Plus I get some safety (I do accidentally check in these debugging print statements from time to time).

But putting -MData::Dump or -MData::Dump::Color on the command-line or PERL5OPT will only work for the code in the main package. What if I pepper debugging statements in some module? That's where another nice module written by Brock Wilcox comes in: everywhere. This module lets you use a module, well, everywhere. It works by installing a coderef at the start of @INC that will trap every require statement and import the modules you want to import everywhere to the target module. By the way, this @INC handler trick is also employed by some other cool modules, among others: App::FatPacker and PAR.

So now you can just put "dd" statements in your modules and test your application with:

perl -Meverywhere=Data::Dump yourapp.pl

or some shorter alias which I'm sure you'll soon create if you use this often enough.

How to Coexist With the Bad People

Is There An Alternative To Long-Term Secrets? presents the mechanism used by LOCKSS (Lots Of Copies Keep Stuff Safe) to ensure that the data you are preserving stays preserved in the face of attacks. (Think peer-to-peer voting to start with.)

Might be something that Bitcoin and the other digital currencies would want to think about...

Well Back on The Moose Track

So after my little crash yesterday I had to revisit my decision to use 'MooseX::AuthorizedMethods' as I was using it totally wrong. It seems to have been defaulted to use a 'User' class of some sort that has a roles method on it which is checked against a passed in array-ref of roles.

Here I was thinking it was checking for 'Moose::Role' classes applied to the calling class and doing all sorts of neat Mossey stuff when in fact this is more 'Instance/Application' code rather than foundation code. Well looking at Daniel's other CPAN offerings I could see how this could be a very very useful default for him. Anyway my bad I should of looked at it closer.

So what to do?

Well after much trial and a whole lot of error I finally got the 'verifier' to work (an example in the POD and or a test would of helped, hint, hint, nudge, nudge, wink wink).

The Hidden Benefit of Data-Driven Programming

Often we hear people talk about making your programming more "data-driven". When you can convert procedural code to a data structure (generally with a small procedural driver), instead of replicating procedural code, you just add another entry to your data structure. This is great with dispatch tables, repetitive chunks of code and state machines. However, there is a hidden benefit of it which will not only make you a better programmer, but it will make later maintenance programmers fail to notice a common flaw that your code lacks. They'll curse you if you have the flaw, but if you don't have it, they'll find that data-driven sections of your code are so easy to work with that they won't even think about it.

Grants Committee May Schedule

May round schedule will be similar to the March round, with several changes as below.

  • Longer period to solicit community feedback
  • Longer voting period
  • Shorter CFP period

In the long run, CFP period should be shortened further as every round will look the same and preparation can be done beforehand. Or even easier, we may always keep the CFP open and evaluate the applications every two months.

Here is the May schedule:

  • May 1: CFP opens
  • May 10: CFP closes
  • May 11: Solicit public feedback
  • May 22: Voting
  • May 31: Announcement of the results

CFP will be posted at news.perlfoundation.org.

Statistics for perl hash tables

The following data is from a 64bit perl-5.19.10 (i.e. 32 bit jenkins - corrected from 64 bit siphash - which randomly shuffles the 2 first entries of collisions), running the core test suite with -DH.

number of hash keys:

Just Call Me Lucky

It seems I lucked out big time with my last post it turns out I was a little mistaken on how 'MooseX::AuthorizedMethods' works.

As you see I ran into this problem today

 

Can't locate object method "user" via package 'Product::Move at C:/Dwimperl/perl/site/lib/MooseX/Meta/Method/Authorized/CheckRoles.pm line 13.
...

That is very odd I thought as it was the same sort of code I used the other day

Announcing App::Midgen v0.32

So what’s new?

  • Follow the meta-2 phase-requirements naming.
  • The ablity to recast phase-requirements.

Plus theres more

  • App::Midgen v0.30 which was a refactor to support Perl 5.8.x

A Couple of other blogs that now make sense to share with you

for the rest of the blog go here

Any comments leave them here.

Perl Encryption Primer: Presentation for Madison Perl Mongers, 2014/04/08

Some ideas for improving the community - The ANA initiative

The following is posted on behalf of Roman Filippov and Al Newkirk, kindly share your thoughts on the mentioned points.

I would like to propose the following items for discussion, in no particular order. This is just a brain dump of the ideas I have been thinking for a while now.

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.