Over Stuffed Moose

Sometimes being both newbie and a keener can be a dangerous combination. Well today I sort of fell into that trap.

Well I started doing the first refactoring of my Moose classes (not for AD&D this time this is some real world code) I was working with. So I wanted to move all the common bits into a single role then create a few 'base' classes that comsume that base roles and add some other sutff. Finally I was going to 'extend' these classes with some default values and then polish them by adding a few roles to customize the end product.

So like this

Custom DBIx::Class ResultSets

On my personal blog I wrote about Veure, an MMORPG that I'm writing in Perl. I followed that up with a post about the roadmap to an invite-only alpha. It's a lot of work, but my company has now decided to commit to it and figure out how to finance the work. This browser game is huge in intended scope, but fortunately, Perl has given me the power to get much of it done quickly. In fact, according to my private Veure github repo, I now have 17% of the ALPHA tasks done. That's up from 0% when I posted the roadmap a little over a week ago. In short, progress is fast.

Currently I'm working on character combat and that's where custom DBIx::Class resultsets have made my life easier.

List of Running Grants

We maintain a list of the running/completed grants at www.perlfoundation.org.

Looking at the running grants list, there's one thing I can clearly say: We need more grants!

In the next few blog entries, I'd like to discuss the efforts we made and we will make so that the grants program is more useful for the community.

Help needed fixing links leading to CPAN

Do you have a few minutes? Please help fixing links leading to CPAN.

Omnia illa, Quae Exspectant

Or to put in other words if you hang around long enough things will change. Well I actually did not have to wait very long at all about a month only. You may remember this post where I was recursively digging in to a directory of code to pre-load a number of Moose classes.

Well I had a solution to fix this problem


Can't locate object method "new_object" via package "Moose::Meta::Role" at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Moose/Object.pm line 27.

when I was trying to invoke 'new' on a role. My rather quick and dirty solution;


  	return
		unless($a_class->can('blessed') and $a_class->can('new') );	

Carrying (mini)CPAN

Thanks to minicpan, I keep a local copy of the latest versions hosted on CPAN. Running minicpan weekly, I keep it up to date. My .minicpanrc file:
local: /home/netbook/minicpan/miniCPAN_20140405/
remote: http://your.favorite.cpan.mirror/
also_mirror: indices/ls-lR.gz
Now, I want to carry my local minicpan keeping it on a memory stick. Changing .minicpanrc to:
local: /media/USB16GB/miniCPAN_20140405/
remote: file://home/netbook/minicpan/miniCPAN_20140405/
also_mirror: indices/ls-lR.gz

GitPrep 1.6 is released - Time zone support, Charset support, and improvement of markdown

I released GitPrep 1.6. You can install portable GitHub system into Unix / Linux easily. It is second major release.

Because you can install GitPrep into your own server, you can create users and repositories without limit. You can use GitPrep freely because GitPrep is free software. You can also install GitPrep into shared rental server.

GitPrep (Document and Repository)

Features added in 1.6 are:

-Time zone support
-Charset support
-Improvement of markdown

1.6 support time zone. You can specify time zone in config file. and support multiple charset. If you specify charset suspecting order in config file, you can see files which contains multiple charsets. Markdown syntax is improved, and support fence code syntax.

Let's use usufully.

Example

You can try GitPrep example.

GitPrep Example

Download

Download

Document

GitPrep Document and Repositry

Grant votes: New announcement format

The Grants Committee has completed the first round of this year. It was my first one as the committee Secretary too. I learned a number of lessons but overall it was smooth thanks to the help from the committee and the community.

As you may have noticed, we have disclosed the voting results in a more detailed way. The motivation is to add more transparency in the process. I hope this will add clarity on what we want to support and what we don't want to use the community resources on.

The voting result of this round consists of the two factors:

  • The number of Yes/No votes
  • The total score given to Yes votes

For each grant proposal, the committee members are required to say:

  • Yes, No, or Abstain
  • Score from 1 (lowest) to 5 (highest) if they vote Yes

Here is the actual statement from our rules:

Are They taking over?

Well after I intercepted this recording secret meeting of the order of Cats (sorry for the commercials but it is a public broadcaster) and as part of their evil plan they
have invaded the world of Perl.

Seem they have some sort of strange influence over PACKMAN and he has recently released 'Acme::CatFS'. Now anyone can do this Cat and embed these annoying creatures anywhere any time.

Well how to counter this take over?? Well I tried to find some other namespaces like thedogapi seems those cats got there first and reserved the name space. I think we are all doomed.

Well all joking aside I did get something useful out of this little ACME
as many are the times where I had to fudge a whole lot of code so I could display some sort of random image or random embedded image without loading it someplace first.

Do not use each

The each hash iterator has two problems which almost nobody is aware of, and which might lead to unexpected and hard to detect problems. We were using the perl-compiler since 12 years in production and just recently found out that the B function walksymtable will miss random symbols from time to time. It entirely depends on hash randomization. I cannot predict what each did to your code.

First problem: Do not change the data

Adding or deleting a key might lead to rehashing, which will re-order the keys. The iterator will just continue and then either miss keys or get keys again a second time.

perldoc -f each:

If you add or delete a hash's elements while iterating over it, entries may be skipped or duplicated--so don't do that. Exception: It is always safe to delete the item most recently returned by "each()", so the following code works properly:

Planet Moose - March 2014

Welcome to Planet Moose, a brief write up on what's been happening in the world of Moose in the past month, for the benefit of those of you who don't have their eyes permanently glued to the #moose IRC channel, or the MetaCPAN recent uploads page.

If you'd like to contribute some news for next month's issue, you can do so on the wiki.

Moo

Although no new version of Moo has been released so far in 2014, there have been updates in March to a few of the modules it depends on:

A smaller, faster, more agile Perl

I've been working on a secret project lately, and I wasn't quite sure it was going work out. Most forks of Perl don't, but because they try to go bigger. I needed something that went smaller. Miniperl and microperl, both parts of the core distribution, weren't enough.

It started with a customer who wanted to limit what could happen, but the Safe compartments weren't sufficient to limit that. I had advised against Perl for this situation, but they were adamant that it had to be Perl. So, I and some of their programmers set about removing or disabling parts from core.

Some stuff was easy. Smart-matching and overloading were gone the first day, but that was only a warm up.

Still Cold eh!

Well you might of read my recent post on 'Temperature-Windchill' and as I have a few mins I think I will use this post to create and send in a patch to this mod so us Canuck's can us it to on near calm days.

Well I should first provide a little background to justify my patch so here is a link NOAA Wind chill calculatior

and the formula as stolen from the Canadian website

wind <= 5 ) ) {
chill=(temp +((-1.59+0.1345*temp)/5)*wind) ;

and for good measure checking the the US version seem they are a little more lazy and just set the wind chill to be the Ambient temperature if it is about that like this

WindChill = ( 35.74 + 0.6215*TempF - 35.75*Math.pow(WindMph,0.16) + 0.4275*TempF*Math.pow(WindMph,0.16) );
if ( WindChill > Temp) WindChill = Temp;

So as this is Canadian wind chill I will add it in (with some pod as I love that part) as its own function

Counting

Did you know that there is a short sound played when you install Win32::MultiMedia::Joystick?

I knew the song, but I had to search a bit. Interestingly, I even had to search the module itself on metacpan (search.cpan.org doesn't provide it as search result). While searching for the song, I realized that I have no program that searches for a short WAV file in a set of MP3 files.

Does anyone has such a piece of code?

Python's decorators in Perl

Python's decorator is some syntax sugar for wrapping functions by another functions:

Google@Home - Remote Control of your home

Google@Home aim is to let control your home in your own way: could be with android device or for example your voice, with the feature of an easy installation on every kind of device that have GPIO inteface and could run Linux.

This is an example of environment setup:

Let's suppose that we are an electronic/computer enthusiast that want to enhance our home with some domotics control, but in non-expansive way. Then probably our choise would be to take some RaspberryPi and relay boards, then link the relayboards to the interested points (shutters, lights, dim lights, etc...) we plan to control: maybe a raspberry for floor it's enough, maybe not, but that doesn't matter. Then we install G@H and we can control those points using the voice, web interface, or even mobile device.

Finally a Perl Mod for Canadians

Well I finally found a Perl mod that was just made for us Canadians (and maybe the Fennoscandias as well). Well when you live where you have snow on the ground at sea level for 6 months of the year and you can get snow 9 months out of a possible 12 this mod is a good one to have around.

I am talking about 'Temperature::Windchill' or how cold does exposed skin feel when there is a wind out-side.

Well if you are like me and spend any time outdoors in a Canadian winter you pay attention to such things as it really could mean your life or death at worse or a least a crappy day in the woods or a good day.

So I was happy to see it as it could be a neat add into any outdoors web site.

11,000 Global Variables

11,000 Global Variables -- 'nuff said.

CPAN RT overrun by spam

Is anyone else seeing this? I'm guessing these tickets are being created by email?

CTRL O Sponsor the DBIx::Class Hackathon

The organisers of the DBIx::Class hackathon would like to extend our thanks and warmest regards to CTRL O (ctrolo.com) for their generous support of this year's hackathon.

CTRL O will sponsor the food for all the attendees on the day of the event and have done so to help contribute back to a project and community who have provided them with a magnificent tool and useful help via irc and mailing lists. We would like to extend our warmest thanks to Andrew Beverly for this generous gift.

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.