April 2014 Archives

YALMT (Yet Another Little Moose Trick)

You might of read my last post where I solved a problems with serializing an object to JSON by using 'MooseX::MetaDescription' well go a little deeper into coding today and then ran into this;

 has 'spell_use' =>(
	is		=>'ro',
	isa		=>'Bool',
        default      =>0,

and then this gets turned into JSON with JSON::to_json I ge…

One more little Moose Trick

Well had another good day with Moose as I solved a little problem I was having when trying to write a serializer for my AD&D Character class.

Well the gist of it is I was starting to set up a little JSON web service nothing fancy just give the current character values when requested. Of course creating JSON is easy just express what you want as a hash ref and then use good old JSON::to_json to make it into a JSON string.

Well that was simple enough but then I ran into the prob…

Where Have You Gone Perl.org??

Been well over a week and the perl foundation web site is still down?

Is anyone out there even aware of this??

There must be someone??

The facebook page has been recently updated and the news page has a recent update.

Some of the members even blog on this forum.

Is there no one out there that can fix it a…

Always somthing new.

Well I was just cleaning up a few things in some very old code this AM and I noticed this
Use Config;

die "chown not available!" unless $Config{"chown"};

and a number of similar lines checking for what I though would be 'core' functions, (like I said this was an old piece of code).

What caught my eye was the 'Config' mod never run into that one before so I had a quick read. I quickly determined that all perl programmers will use this module in onlyu one of three ways

  1. Never have a need for …

Well its not software or codeing but it is a good story

Well I blundered upon Morale a rather old bit of code that has been around since the last century that total and as it is rather unremarkable old school, well that is unfair really as it was written well before there was a new school and most new school programmer will still playing with their gameboys, that simply stores a scalar value of 1 to 100 for a uses moral and can also calculate the moral for the g…

Gluu fer the Wëëbb Part 3

There is always more than one way to do something in perl and Toto definitely lives up to that old adage.

When I first started I simply aped what was on the POD so my set up was like this

plugin 'toto' =>
nav => [ qw{character} ],
sidebar => {
character => [ qw{character/list character/search character} ],
tabs => {
character=> [qw/view edit delete/],

which is fine but a doing a little more sniffing about …

A Day Without Perl

Well back at my desk today and slowly reinstalling DWIM perl and padre after yesterdays lunch disaster so I took the time to snoop about on the enlightened perl or EPO site for a few mins.

Well still not much going on there since the last time I had a look about two years ago at least the send a newbie initiative seems to be humming along.

They still have the same dead link on…

One for the Road

Well on the way home now and over lunch stop I discovered there was WiFi at the Tim Horten's so I took the opportunity to try and load in 'Padre::Plugin::Autodia' as it seemed like a good quick blog post while I am on the road as I had 'GraphViz' installed already it should go smoothly, right?

Well wrong.

Things started out fine then Padre started to recomile and after a half hour of wizing and whiring if failed.

I tried to start Padre but it never came up it …

Perl on Vacation

Well day two way out here very very far from anything and with my good old 34k line and my wife wants to watch the sunset over the Atlantic. Well I told here that is not going to happen here as the sun only rises over the ocean you will have to wait till our trip to B.C. in a few years.

I did tell here she could get up to watch the sunrise. Great what time is that. Well not having my copy of 'ADMIRALTY Sailing Directions' handy, and no GPS and really no Internet or phone connection or even T.V. All I had was a tide table from 6 years ago but at least I did have the lat and long fr…

Meeting Perl while on Vacation

Well bandwidth is still a problem for me these days (can you even remember 56k dial-up) so just a short post.

Well on the road today I met Perl at least 3 times and I wasn't even on line.

Well first we passed a semi hauling a load of cars and I looked up and saw a sticker on it saying powered by CargoTel. Well some of you may not know, well most maybe, that the CargoTel network for car delivery logistics is 100% Perl.

Well stopping at a very remote site in the afternoon I saw a sign that said 'As Seen On 'Tripadvisor.com' again another site that uses a good deal of…

Well it is worth the wait?

Well being out here in off-line land I took some time to work on formating some YAML files for my ongoing AD&D game. Well I was ok until I had to parse some things. Usually I just lay with my good old online YAML parser but I was finding it a bit trying what with the slow speed and late hour.

Then I remembered that some time ago I had used such a thing with Padre and sure enough after about 5 mins searching on Map of CPAN I ran into Padre::Plugin::YAML So I decided to gi…

Where to find the good stuff

One thing I ave found when doing a little research for this post was the very large number of perl tutrials out there and how many where well over 10 years old some as old as 15.

Well still stuck here in limited access land so I had a quick look around and found this site

So in about 10 mins of reading I now know where to send anyone who asks me where to go for good tutorials.

There is also a good chance if you want to help out as the…

Well A long way From home

Well I am a long way from home today and of course I had to check in and look at a few things.

Well No problem with the modern web just connect in from anywhere in the world and do your work.

Well my internet connection is 34kb so not very broad as well I using my cousin's computer but at least I can get my google mail and use good old ftp if I need to copy anything to and from the remote site

Well that is all great and good but I had to do some very quick debugging on a web site I sometimes help maintain. Well with the very limited connection speed I was timing out…

Gluu fer the Wëëbb Part 2

Well in my first post of this series I just managed to get a listing up and running utilizing the Toto plugin well lets move on a little.

Well it seems I have my list and the underlying urls I have 'http://localhost:3000/character/view/Glarp_Gnlnarn' which is correct but of course it is not a 100% 'REST' as I think that by convention 'character' should be the plural 'characters' but then again in the POD they say this is a BREAD interface not a REST and the author defines it as

'- in a BREAD application, br…

Gluu fer the Wëëbb Part 1

Having been a fan of Mojolicious for a few years it is only reasonable that I pick it as the platform but this time instead of going with my usual default layout and architecture I wanted to give the Toto plugin a whirl.

This plug-in provides a bootstrap flavoured navigation framework. So you can get a nav bar running across the top one, a side bar for and a row a and also a row of tabs underneath each side bar.

Well out of the box w…

Moose to The Resque

Well not really but it did save me a good deal of time. I have been slowly putting together a small stand alone web app with Mojolicious to trunly demonstate what I have been doing with all these Moose posts.

Well I was just setting up a controller (using Mojolicious::Lite here to save space) and was creating my first form and like I many I have created before I started with a validator; something like this

app->validator->add_check(range => sub {
  my ($validation, $name, $value, $min, $…

Relief from Regexes

As most of the readers on this blog know that my sys-admin skills are not on the high side. Well also one thing that I am very poor at is regexes. I know I hold my head in shame in this, I just never used them very much and most of my programming hasn't been in the area of text processing so I have never use them very much.

Most of the time when I run into a regex I can figure out what is going on but when the complex ones come into play I am just flustered.

Well I stumbled across this today Padre::Plugin::Rege…

A Little more Testing of the waters

Still exploring the MooseX name-space these days and today I was going to have a look at 'MooseX::YAML' as that was the format I was saving my AD&D data in it (for the time being) I thought it might be a good fit to load things up faster or at least save me some code in writing a YAML parse role.

So I started out with a little YAML to test

use MooseX::YAML;

my $dwarf_yaml = <<YAML;
- Fighter:8
dexterity: 15
constitution: 16

My Master Voice

One part of AD&D that I allays loved and why I played it for so long was its story telling nature. I can't tell you how many reams of paper myself and the rest of us players and DMs produced in our epic mutil-year game, Still have a few stuffed upstairs in the attice where they where shoved after life caught up with me and my cohorts and the joys or, wives, husband, jobs, houses and kids overtook our game.

It was the 'in-character' and 'NPC' conversions that where always best as some of my fellow players where very good at it. One player what an expert at imitating a ranting nut b…

Still Plinking Away, The End Game

Well it is time to make a choice! I started with three and took another good look at was available in the MooseX space on CPAN today and didn't see anything else that I think would do what I want. Though I was quite interested in Moose::Templated until I figured out it was a template system for rendering content utilizing roles rather that what I was looking for a template system to create roles and classes.

Anyway back to my choic…

lex parsimoniae

For the less classically trained Occam's Razor or to dumb it down even more, the answer is staring you in the face, is the topic for tonight.

Well to make a short story long, I was happily programming along, in the zone if you will, when I was flustered by a small problem. How to tell if something is an object??

The problem occurred in a class pre-loader, it gladly recursively searches though a name-space and loads in classes for future use. There is some sanity checking such as making sure the file at least ends …

Plinking Away Part the Fourth

Well my last post trying to work with MooseX::ClassCompositor was a bit of a bust as it is not what I needed. So onto the next one one my list 'MooseX::ShortCut::BuildInstance' so lets have a look and see what this one can do for me.

Well at first glance it seems a hybrid of the last two, it does follows the same basic pattern, give a base class add some roles and then get a instance. With thi…

Plinking Away Part the Third

In my last post I had a look at how MooseX::Abstract::Factory worked and what it could do for me. Today I will continue down my little list and have a look at

Well at first glance it seems this could really work for me. Start with an empty class and add in all the roles. So lets have a closer look. Like the last module the document…

Plinking Away Part the Second

In my last post I identified three MooseX modules that might help me out and end the perhaps some tedious typing and bring a more structure design into my ADD game. The first of this is MooseX::Abstract::Factory.

Despite its name it does not actually create 'Abstract' classes in the sense of a class that cannot be instantiated like a 'Java Abstract Class'. I guess what they mean is a 'Factory that is Abstract' i.e. not tied to any one class or name-space.

Despite this little bit of confusion on the part of a griz…

Still Plinking Away, Part the First

So of you might remember this post some weeks ago where I came up with a huge org-chart of all the different roles they I thought i would need for may AD&D characters.

Well I was just now getting into the actual instantiation of characters and having them do something well I ran into a number of differing choices that I sort of discussed here on this post. I found that the visitor pattern worked very wel…

One Moose, Many Mooses, or is that Mise?

Now that I am getting into the game play part of AD&D I am finding there are more and more times where I want to keep a record of some attribute not just a running total.

For example after a successful encounter experience for monsters killed or defeated (making them run away is defeating them) and the value of all treasure taken in gold peices is summed and then split evenly across all party members, including henchmen and friendly NPC, who actively engaged in the encounter as Expreriance Points or EP for short.

Well a running tally for each player is needed, as well playe…

Well More Little Helpers

Had a power outage for most of the day today so just a short post carrying on from where my last post left off.

Again I figured I might as well add in a second function into my little mod this one parses a directory listing (very badly) and then prints out the English for it

I do not usually have much of a problem with file entries but I figure some people might be worse at it than me so here goes.

So I exposed 'parse_file_listing' in my mod and here is a sample

use ParseCHMOD;


I Was so Impressed I Wrote More Code

I guess I was inspired by by Bradley Andersen's little perl mod 'ParseCron' do a little code writing in the same vain.

Like I mentioned in my last post there many aspects of sys-adm that boggle my little mind and on of the chief ones is how 'chmod' converts a slew of 3 digits into unix style file permissions.

I get the rwx or - part on the files system that is easy enough. It is how 756 does its majik…


I am very proudly not a sys admin I am so bad in fact I can't even spell it correctly. This of course has its disadvantages in the perl world where it seems every perl knows what this does.

ls | perl -pe 's!([^_]+)_(.)(.*)!mv $1_$2$3 \u$2\E$3!gio'

and at a YAPC I was the only one in the room that did not laugh at this

su root chmod 000 chmod 

I felt very left out.

Well call it my nature, as my natural skill set precludes sys-admin. I just find trying to remember all those …

Roleing Along Like a Tumbling Tumbleweed

Well here is a little store from the trenches today that oddly enough does has something to do with Moose and roles.


About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations