Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

lilstevey (4628)

lilstevey
  (email not shown publicly)

Consumes:
  • Heinekin
  • Kro
  • Addlestones
  • Old Rosie
  • Thatchers
  • Strongbow
  • Erdinger
  • Guiness
  • Budvar
  • Leffe ( usually blond )
  • Various Real Ales when in premises suitable

Journal of lilstevey (4628)

Tuesday December 29, 2009
08:02 PM

Is Avatar Just Smurf Porn?

Not a great deal perly of late - winter solstice, xmas and the upcoming new year has absorbed much of my free time.

I thought it might be worth blogging some of my tv watchings though. Saw Avatar 3d in the cinema which was quite an emersive experience - not sure the story could have carried it without the amazing effects though. Highlight of tv thus far has been "The gruffolo" on bbc 1, closely followed by top gear - which despite what I perceive to be increasing friction between May and the others was still an amazing piece of television. If they do End it, I hope they manage to do a few one off specials such as the south america trip - It was up there with the asian trip ( was it korea or vietnam? ) and the african venture a couple of series ago or so.

Anticlimax of the "holiday" was Dr Who on chrimblemas day. I'm dissapointed in some ways that Tennant is leaving, but very thankfull that Russell T Davies is moving onto new projects. I don't think that I could write as well as him, but thats because I'm a developer. How's this for an alternative last episode arc:
  • Corrupted by the events on Bowie Base, Who tries in vain to redeem himself, falling more and more into a spiral of self destructive behavour
  • His "Daughter" returns - remember her from that cloning episode - and becomes companion for some of the adventure before realising that something very wrong is afoot.
  • She then tricks the doctor into leaving her in charge of the tardis key.
  • Who realises his mistake, and in something of a battle, takes an all or nothing gambit and gambles on his daughter not being able to re-generate, plunging them both into a certain death situation.
  • But... Who is wrong - Daughter regenerates into new doctor, scapering off with the key ... Who, corrupted by his own power regenerates into The master, played by Mr Simm.

And with that brief blog I'll trundle off to bed and prepare myself for the end of 2009.

Monday November 30, 2009
05:21 PM

dynamically attaching a method to a class in perl6

In case you've just tuned in, I'm trying to learn a bit of perl6 by attempting to create a simple RMI system. And with that, once more into the breach...

Since my last petty fiddling there has been another release of rakudo, so I feel like I should begin with a swift re-installation of rakudo - using the "git clone gen-parrot technique"

Whilst thats running I'll make a few notes. After I looked at the server side of things, I began to have a look at the client. In perl5 I'd tend to use AUTOLOAD to fullfill a variety of object calls on a method, so I thought it worth a punt to have a play in that direction. I didn't get very far, but wasn't that motivated as given the processing needed to generate a method proxy, and also the perl6 Type-checked idium, it seems to me to be more of a composition rather than on call issue?

Whilst I've been doing other things, perl6 has marched forward. I was particulary interested in a use post from Jonathan Worthington, which pointed to a lovely doc on The Rakudo Metamodel.

Of particular interest was this item in the "Package meta-object API (aka HOW API)" section:

add_method($meta, $name, &code_ref)
Adds a method to the methods table of $meta under the given $name and with the given implementation.

Could I use this to generate a proxying class to fullfill a role? If so, the prospect is quite exciting.

Lets have a play-then-think go with it, starting off with TestRole as used in my Nov. 11 use.perl post.

And then I think... Maybe I'm getting ahead of myself. Maybe I should start off where the Nov 11th post left off.

From this post, I'll modify it a little using perl6's very funky iteration syntax, and start off with:

thursday.pl use v6;

use TestRole;

my $r = TestRole;

my $c = class{};

my $code = { say "bloot bloot I am not a newt" };

for $r.^methods(:local) -> $m
{
   my $mn = $m.name;
   say "$mn";
   # Do something to add $code to class $c with method $mn
}

Sometime, between multiple distractions, and blogging $this, the compilation and make has finished. It's now all done, and I'm left contemplating the contents of the "# Do something..."

Much playing follows. Needless to say - its not as simple as add_method($c, $mn, $code), though the output is mildly curious:

C:\ ... >perl6 thursday.pl
randomWWWRRRChars
Could not find non-existent sub add_method in Main (file src\gen_setting.pm, line 295)

Which seems odd, because it's not the first method in the Role. note - In case anyone is interested, thats a metaphorical thursday, from police squad... ( 6:00 minutes if anyone is interested ). All these years I thought it was tuesday...

I wasn't expecting that to work, but aren't sure as to how I get this command working. The temptation is to try #perl6, which is perhaps the friendliest IRC channel I've ever seen, and it's the common sense place to be, but much to my shame, I didn't spend enough time on IRC in the mid 90's - instead I was writting HTML templating systems in perl and playing with POV. That and down the pub. Well, mostly down the pub. Since then, having not gained experience, I've found IRC to be an intimidating place. Even though #perl6 appears to be one of the most welcoming places on earth, there still seems to be a bit of crypticalness to some of the syntax shown when I've been lurking. Some of the behavour suggests bots and I'm not too sure if "thanks" carries the same weight as a ++ postfix. Added to that, the people on their are doing great things, and I'm not sure I want to distract them with my petty problems, given that my free time is rapidly evapourating...

OK, I'm being pathetic. Very very pathetic. Better see if anyone is online, and can help. Off to #perl6 after checking the #perl6 logs in order to retrolurk.

Once again #perl6 were very very nice. I should declare that I googled up IRC etiquette before venturing forth ( though it's not the most useful document on the internet ). masak and diakopter were very helpfull (and friendly), Apparently the code that will provide the one liner I require is apparently being worked upon by jnthn++, but, for now, eval may give the solution I need.

for now, however, bed calleth... goodnight world...

And wakey-wakey post worky. Top Gear is on. BBC iplayer is great. May has been flying a caravan and Clarkson and Hammond are covering the Lancia.

Earlier today, on the borderline of yesterday, masak provided the following example during our IRC conversation, whilst taking part in other discussions. I'm slightly in awe of the multitasking:

class A { if rand < .5 { eval("method foo() \{ say q[foo] }") } else { eval("method bar() \{ say q[bar] }") } }; A.new.?foo; A.new.?bar

After a little hammering at the keyboard I come up with the following:

friday.pl use v6;

use TestRole;

my $r = TestRole;

my &code = { say "bloot bloot I am not a newt" };

class proxy
{
   for $r.^methods(:local) -> $m
   {
      my $mn = $m.name;
      eval "method $mn () \{ &code() }";
   }
}

my $i = proxy.new();
$i.method1();

Running it does the following:

C:\ ... >perl6 friday.pl
bloot bloot I am not a newt

Woot! Enthused, I fire up the the server from my November 24 use perl journal, copy the RmiClient class from my November 09, 2009 post, and type furiously:

saturday.pl use v6;

use TestRole;
use RmiClient;

my $p = RmiClient.new(url => "http://localhost:8888/");

my $r = TestRole;

my &code = { $p.proxy( $_ ) };

class proxy
{
   for $r.^methods(:local) -> $m
   {
      my $mn = $m.name;
      eval "method $mn () \{ return &code( \"$mn\" ) }";
   }
}

my $i = proxy.new();
say $i.method1();

And, joy of joys:

C:\ .. >perl6 saturday.pl
1 - method one

It needs a heavy dose of refactoring, but its a start, and being a start, a suitable end to this post... I might start the next one by ensuring my environmental variables are pointing to the rakudo I started building at the start of this post.

Tuesday November 24, 2009
02:49 PM

tweetscale progress

I started having a play over a week ago but haven't had the time to do much - I'll blog this and see if I get any time to go further.

This entry is brought to you by use v6; - a delightful experience.

Perl v6.0.0 required--this is only v5.8.9, stopped at testserver.pl line 1.

I've been doing statically typedish language for too long. Theres me leaping into introspection, when, for now, for the serverside of things, a simple bit of dynamic programming will suffice. Lets quickly knock out a simple server.

testclient.pl
use v6;
use Server;
use TestClass;
use TestRole;

my $tc = TestClass.new();
my $r = TestRole;
my $a = Server.new( clzz => $tc, rle => $r );

$a.startServer();
Server.pm
use v6;
use HTTP::Daemon;

class Server
{
   has $clzz;
   has $rle;

   method startServer() {
      my HTTP::Daemon $d .= new;
      say "see {$d.url}";
      while my HTTP::Daemon::ClientConn $c = $d.accept {
         while my HTTP::Request $r = $c.get_request {
            my $p = $r.url.path;
            my @p = split "\/",$p;
            my $m = pop @p;

            if ( $r.method eq 'GET' && $rle.can( $m ) ) {
               $c.send_response($clzz."$m"());
            } else {
               $c.send_error('RC_FORBIDDEN');
            }
            warn "{$r.method} {$r.url.path}";
         }
      }
   }
}

Thats as simple as $rle.can( $m ) && $c.send_response($clzz."$m"()) - though my first attempt was $clzz.$m() - which resulted in "invoke() not implemented in class 'Perl6Str'"

Now to see what can be done on the client...

Wednesday November 11, 2009
06:44 PM

More perl6 babysteps - finding the methods of a role

Lets start here:

http://dev.perl.org/perl6/rfc/335.html

So I code, tentativly....

test.pl
use v6;

use TestRole;

my $r = TestRole;
say $r;

my @m = $r.methods();

say @m;
TestRole.pm
role TestRole
{

   method method1 ( ) { }
   method wildcard ( ) { }
   method randomWWWRRRChars () { }
   method SPLEEEERRRGGGG () { }
}

Results:

C:\ ... \ex6>perl6 test.pl
TestRole()
Method 'methods' not found for invocant of class ''
in Main (file src\gen_setting.pm, line 295)

And there lie the daemons... The perl6 ghost docs. Lets try to find something more up to date...

One of the memories of potentially relevant browsing I have is this fella - Jonathan Worthingtons fine work on Signature Introspection And here is a funny thing - anchors are wonderfull, wonderfull things - and delightfully cross discipline. I now recall meta... meta class...

Pause to contemplate. maybe google "rakudo ..." would be a better starting point for future searches.

And back to meta... Apocalypse 12 is about objects and contains some examples:

   MyClass.meta.getmethods() # get the method list of MyClass

It may well be that my rakudo does not yet have the features. Lets get a more recent version.

I start by cloning git://github.com/rakudo/rakudo.git - and trying to install with the --gen-parrot option - unfortunately as I didn't get around to installing subversion - a visit to http://subversion.tigris.org/ should fix that - I end up pumping for Silk Svn - an svn client for windows.

Now I should have tested this before but the signature introspection is now working, unfortunately it looks like meta isn't ( as yet )...

C:\ ... >perl6 testsig.pl
Name: $x, Type: Int(), Optional: 0
Name: $y, Type: Str(), Optional: 1

Now lets not give up there - a quick visit of the test suite for perl6 introspection provides an interesting syntax:

@methods = B.^methods(:local);

Lets give that a go... A slight change to test.pl is all that is needed.

test.pl
use v6;

use TestRole;

my $r = TestRole;
say "$r Has the following methods:" ;
my @m = $r.^methods(:local) ;
say join "\n", @m;

And a short perl6 test.pl later....

C:\ ... >perl6 test.pl
TestRole() Has the following methods:
method1
wildcard
randomWWWRRRChars
SPLEEEERRRGGGG

A small, small step. This elephant is going to take a while nibbling at this pace.

Monday November 09, 2009
06:28 PM

more tentative perl6 hacking

A little more work. Following some wise words in masak's journal about starting simple, I decided to take further tentative tiptoes further towards my target of a transparent Role-As-Interface based RMI system by first of all just hacking together a call from client to server. Following a visit to the lovely people on #perl6 I got a pointer to the perl6 test suite which, when read with the synopsis & apocalypse documents, seems to give a reasonable set of reference documents.

Anyway, squeezing this around other commitments, I hacked LWP::Simple and HTTP::Daemon around a little, and created the following files:

testclient.pl
use v6;
use RmiClient;

my $r = RmiClient.new(url => "http://localhost:8888/");

say $r.proxy("Greet");
RmiClient.pm
use v6;
use LWP::Simple;

class RmiClient
{
   has $url;

   method proxy( $method )
   {
      my $s = LWP::Simple.get($url~$method); # "http://localhost:8080/"
      my ($r1,@r2) = split(/\n\n/,$s);
      my $r2 = join '\n\n',@r2;
      return $r2;
   }
}

1;

Thats the client side of this simple test, now onto the server side.

testserver.pl
use v6;
use Adapter;
use TestClass;

my $tc = TestClass.new();
my $a = Adapter.new( clzz => $tc );

$a.startServer();
Adapter.pm
use v6;
use HTTP::Daemon;
use TestClass;

class Adapter
{
   has TestClass $clzz;

   method startServer()
   {

      my HTTP::Daemon $d .= new;
      say "see {$d.url}";
      while my HTTP::Daemon::ClientConn $c = $d.accept {
      while my HTTP::Request $r = $c.get_request {
      if $r.method eq 'GET' {
         $c.send_response($clzz.Greet());
      }
      else {
         $c.send_error('RC_FORBIDDEN');
      }
         warn "{$r.method} {$r.url.path}";
      }
      }

   }

}
TestClass.pm
use v6;

class TestClass
{

   method Greet()
   {
      return "Hello World";
   }

}

That is quite filthy, but a start. Next up is one of two things:

  1. trying to make implementing a client as simple as passing a Role-As-Interface into some manner of magical constructor/repository.
  2. Passing a Role-As-Interface and implementing class into some manner of thingy on the server that exposes methods defined in the Role-As-Interface and implements them using said class.

These "simple" steps may possibly include a tour round some other areas, including a look at serialisation, dependency injections, singletons... Still only one way to eat an elephant...

Sunday November 01, 2009
07:16 PM

Fighting with perl6 HTTP::Daemon install

I found this useful Installation howto draft ( note to self - must spend more time studying the parrot.org site and documentation and rely less on google ).

An important consideration is that some of the scripts are perl 5 - I guess self hosting is some way off now. Unfortanately, the second run of proto doesn't look like it produces the desired result:

C:\perl6\development\proto>perl proto
'git' is not recognized as an internal or external command,
operable program or batch file.
'svn' is not recognized as an internal or external command,
operable program or batch file.
If you want rakudo in parrot it has to be in <PARROT_DIR>/languages/rakudo at proto line 94.

Curses. Maybe I should have added windows command line support when installing git. The directories probably need sorting sooner rather than later. Probably worth drawing up a todo list:

  1. re-install parrot and rakudo to conform with rakudo in parrot ( ie in <PARROT_DIR>/languages/rakudo )
  2. install svn command line client
  3. install git with command line support

Maybe time to momentarily chill and tolerate some more of battlefield earth.

Some sleep later. I start off the day by contemplating alternatives - Microsofts Virtual PC 2007 does not appear to run on windows, and "vmware player"'s download page appears to be down for maintenance. Arse.

I have a linux box (not connected to a monitor - I use it for svn and as a printer server) I'll pump for VNC Free edition. There appear to be a large set of instructions for configuring remote access to an ubuntu desktop at howto forge. This is where I run into problems - the linuxbox uses the tv as a monitor, and there is no way on this earth that the missus is going to let me disturb the Abu Dhabi grand prix.

In the mean time I'll re-install parrot and rakudo in a more standard layout. I have a c:/perl6 dir from my proto excursion, so I'll make a c:/perl6/install for the sources, and copy parrot to there, make a sub dir c:/perl6/install/parrot/languages and copy rakudo in there. I've renamed the source directories to parrot and rakudo - loosing date and version information

I already have strawberry perl and ICU installed so this should be straightforward. I won't go into detail as I would just be repeating myself.

A little while later and I have a more traditional layout. A quick perl6 Configure.pl and a mingw32-make gives us the same nasty error:

C:\ ... \httpd>mingw32-make
mingw32-make: *** No rule to make target `lib/HTTP/Daemon.pir', needed by `all'.
Stop.

Lamb Rogan on the sunday special at the local curry house. Was particulary pleasant. Relaxed and watched telly before trying to find out what stupid something was blocking my path. It looks like, for some reason, the Daemon.pir file had a trailing single quote after the .pir extension - I remove it and retry.

Configure.pm is preparing to make your Makefile.

PERL6 C:/perl6/install/parrot/languages/rakudo/perl6
Use of uninitialized value
PERL6LIB /lib
PERL6BIN /bin
RAKUDO_DIR C:/perl6/install/parrot/languages/rakudo

Makefile is ready, running 'make' on it.
Use of uninitialized value
'make' is not recognized as an internal or external command,
operable program or batch file.
Configure and 'make' have finished. Use 'make help' to view other options.


C:\ ... \httpd>mingw32-make
cc C:/perl6/install/parrot/languages/rakudo/perl6.o -o C:/perl6/install/parrot/languages/rakudo/perl6
process_begin: CreateProcess(NULL, cc C:/perl6/install/parrot/languages/rakudo/perl6.o -o C:/perl6/install/parrot/languages/rakudo/perl6, ...) failed. make (e=2): The system cannot find the file specified.
mingw32-make: *** [C:/perl6/install/parrot/languages/rakudo/perl6] Error 2

Largely out of frustration, I copy the Daemon.pm file into a subdir of my test dir, and knock up the test script in the docs.

The output of the script is:

C: ... \ex3>perl6 test.pl
see http://localhost:8888/

Browsing to the url mentioned gives:

This is root.
Go to pub

So thats a small step forwards. Leaves me wondering though - howcome there needs to be a perl6 Configure.pl step if this runs on a virtual machine - whats wrong with distributing either zipped up bytecode or perl6 sources? No doubt there is a good reason for this - I just need to find what it is... Unfortunately it's to late to "Go to pub". Perhaps Bed is more appropriatte.

I have to blog this. I've just been watching cable telly, and the host of a late night interactive gameshow reckons we are all going to get it in, in apocalyptic terms, in december 2012. Apparently a lot of things have been written about it and its all cyclic. Bizarre.

07:53 AM

first steps in coding in rakudo

Ok. So I've managed to install perl 6. And Rakudo. And run "hello world". Clever me. Not.

Anyway. Having installed parrot I'd like to have a play, and try to do something marginally less trivial. Whilst not a popular view in certain circles, I enjoyed developing software in java until recently. In particular, I found the remoting capabilities and ease of such in Spring quite delightful to work with. To me, a comment on Ovids Blog by Dominus summed up what I perceived to be the underlying principal that gave rise to the aforemention sentiment.

I realized after a couple of years that architects have the same distinction. They have "structural" and "functional" elements. The simplest example is a tent. It has a functional element, which is the cloth; the cloth is the whole point of the tent, which keeps the rain off of you. But it also has a structural element, the tent pole, whose purpose is to hold up the cloth. The pole is a pure liability. If you could get the cloth to stay up with no pole, you would, but you can't.

So instead of "natural" and "synthetic" I now discuss it in terms of "functional" and "structural" code, which I think makes the point better.

From memory, the way this was approached was that remoting was treated as a configuration - in code, an interface was written, and a configuration file was used to expose this as a service. The plumbing ( structural elements? ) was hidden from the code, and I didn't need to care about it. If I wanted, I could test the implementation of the service, without having to start up http deamons or such like.

So, what I would like to do is create an interface in perl 6, and write some external code to allow a remote client to access this service. For starters I'll make a bloated service, rather than delegating the functionality to some manner of model or domain layer - just to keep it simple.

My first task is to figure out how I'm going to accomplish this. In stumbling about on t'interweb, I found a comment and subsequent thread on perl monks interesting Re: Open to debate on mixins and traits..

So I assume that I need a role to specify the behavour of the underlying class, and a trait to provide the glue between server and client? Or do I need to use signatures?.

I guess I'll have to wait and see. I'll start off with something simple - trying to define a role describing a greeting method on a class, and some other code which will implement said role.

Firstly, I'll try to get a simple example together:

Test.pl
use TestInterface;
use TestImplementation;

my TestInterface $a = TestImplementation.new();
$a.Greet();
TestInterface.pm
# TestInterface
role TestInterface
{
   method Greet(){}
}
TestImplementation.pm
use TestInterface;
class TestImplementation does TestInterface
{
   method Greet()
   {
      say "Hello World";
   }
}

Executing the above code snippets results in the following:

C:\ ... >perl6 Test.pl
Hello World

What I like about using an interface is it seperates an agreement of function to the performance of said function. IF the above code is valid, it seems to acheive that. The next stage I want to go onto is to squeeze into the tidy little arrangement, and make the client ( Test.pl ) Less dependenant on the specifics of the implementation. I'll do this for the time being by introducing a factory class - the modified examples look like:

test.pl
use TestInterface;
use TestFactory;

my TestInterface $a = TestFactory.new().TestInstance();
say $a.Greet();
TestFactory.pm
use TestInterface;
use TestImplementation;

class TestFactory
{
   method TestInstance() returns TestInterface
   {
      return TestImplementation.new();
   }
}

The only other change is the alteration of the method Greet in TestImplementation.pm to return rather than say the greeting. Now at the moment, this might seem like a lot of unecessary waffle. However, in practice, the TestFactory class becomes part of the framework, reducing this additional step.

Running this code results in the same result as earlier.

So. Whats next? For me at the moment, bed calls. And a day at work. More to come after. I guess the next step is to find some socket code in perl 6 and try to knock up some remoting, before trying to see what kinda bindings can be done automajically.

Returning to it after a couple of evenings off. Once again, watching tv simultaneosuly. This night, "Jumper" and Coraline are on the cards...

The path now diverges.... In order to construct a simple RPC "layer" I need a means of communication - perhaps using a simple httpd for starters. I also need some means of reading the "interface" role, and "somehow" tieing it to said client and server. I'll start by trying to make a simple server.

So, to start with I need a server, fortunately http-daemon has been ported to perl6.

http://gitorious.org/http-daemon

I don't have GIT so I need to get it. I google up http://git-scm.com/ - a site which appears to have one of the coolest looking logos going. finding the git on windows mysys varient. I'll give it a blast.

C: .. \httpd>perl6 Configure.pl

Configure.pm is preparing to make your Makefile.

Found a PARROT_DIR to be C:/install/parrot-1.7.0
but there is no Rakudo nearby. Please contact the proto people.

drat!

It turns out RAKUDO_DIR environmental problem is not set. I try, but no luck - still fails. I try the RAKUDO_DIR argument to Configure - same message.

Have a browse of the configure code. It loks like its expecting rakudo-in-parrot or parrot-in-rakudo. My setup looks a little unconventional. I made a new folder "languages" in PARROT_DIR, create a rakudo subdir, and copy the contents of the rakudo install DIR. The output of configure.pm now looks a little more promising:

C: ... \httpd>perl6 Configure.pl

Configure.pm is preparing to make your Makefile.

PERL6 C:/install/parrot-1.7.0/languages/rakudo/perl6Use of uninitialized value
PERL6LIB /lib
PERL6BIN /bin
RAKUDO_DIR C:/install/parrot-1.7.0/languages/rakudo

Makefile is ready, running 'make' on it.
Use of uninitialized value
'make' is not recognized as an internal or external command,
operable program or batch file.
Configure and 'make' have finished. Use 'make help' to view other options.

However, the "make" errors look worrying.

C:\ ... \httpd>mingw32-make
mingw32-make: *** No rule to make target `lib/HTTP/Daemon.pir', needed by `all'.
Stop.

A little digging later and I stumble across proto - this looks well worth a look - though perhaps tommorow as it's time for bed. Perhaps it might also be pragmatic to at least rerun configure and make on rakudo in its new location - or just re-install things in what appears to be a more normal layout?

Wednesday October 28, 2009
06:59 PM

perl 6 - a "re-dip"

In response to my last Rakudu/Parrot post, daxim responded with a clear and concise answer, of which I am very greatful.

parrot_config is an executable, installed by default in $PREFIX/bin/parrot_config. Run parrot_config --dump to see interesting stuff.

I'm now watching Britains Best Dish - a fascinating show in which predominantly amateur cooks cook a single dish - either a starter, main or a dessert. This week is the finals, and today 6 or 7 main courses get whittled down to the final two. Its very british - game dishes and pies.

Anyway, I digress.

I now run:

perl Configure.pl --parrot_config=c:\Parrot-1.7.0\bin\parrot_config.exe

and

mingw32-make

and again have the previous error:

In file included from perl6_group.c:17:
/Parrot-1.7.0/include/parrot/parrot/parrot.h:235:23: libintl.h: No such file or directory
mingw32-make: *** [src\pmc\perl6_group.dll] Error 1

That appears to be "libintl.h." perhaps it's related to the dependency on the ICU library mentioned at: http://rakudo.org/how-to-get-rakudo

Breaking now for the pub quiz.

Ok. back from pub quiz.

I have:
A win32 platform
Downloaded Parrot win32 installer
Downloaded Rakudo

I attempted to install them by downloading the parrot win32 installer, and downloading the rakudo tar.gz installer. Then I got a little lost.

I believe I messed it up by not concentrating on the task in hand, and instead doing it in the background whilst watching a rather excellent film ( the Last King of Scotland ) for the first time.

So I think I have missed a dependency - the ICU library.

I visit the site and try ICU4C, downloading "Windows (win32 x86 32-bit) Visual Studio 9".

After a snooze and day at work I have another bash.

Rakudo docs at http://github.com/rakudo/rakudo/blob/master/README suggest:

In order to fully support Unicode, you'll also want to have the

ICU library installed (L<http://site.icu-project.org/>). Rakudo can run without ICU, but some Unicode-related features may not work properly.

which seems odd if the lack of ICU is causing the problem, and maybe I'm reading the following wrong, but to me the http://rakudo.org/how-to-get-rakudo site seems to be contradictory:

Building Rakudo from the sources requires Perl 5.8 or newer, a C compiler, a make utility, subversion, and the ICU library.

Turning to google again, this page turns up: http://cpansearch.perl.org/src/ARANDAL/parrot-1.0.0/README_win32.pod with some nice instructions on installing ICU - I install it and add it to path as it suggests. I download parrot 1.6 from parrot.org

\parrot-1.6.0>mingw32-make
"Compiling with:"
xx.c
Can't spawn "cmd.exe": No such file or directory at tools\dev\cc_flags.pl line 152, <$F> line 37.
mingw32-make: *** [flags_dummy] Error 255

The "Current developer release" on the parrot download page seems to point to 1.60, so I download 1.7 instead. I'll have a play with that.

C:\install\parrot-1.7.0>mingw32-make
"Compiling with:"
xx.c
Can't spawn "cmd.exe": No such file or directory at tools\dev\cc_flags.pl line 152, <$F> line 37.
mingw32-make: *** [flags_dummy] Error 255

So I try to run cmd - it fails - so lets try setting the appropriatte path and starting again:

set PATH=%PATH%;C:\WINDOWS\system32

Misconfigured system perhaps? Lets run configure again...

It was going so well...
Invoking Parrot to generate runtime\parrot\include\config.fpmc --cross your fing ers
.\miniparrot.exe config_lib.pasm > runtime\parrot\include\config.fpmc
mingw32-make: *** [runtime\parrot\include\config.fpmc] Error -1073741515

with the popup:

miniparrot.exe - Unable to Locate Component
This application has failed to start because icuuc42.dll was not found. Re-installing the application may fix this problem.

Maybe I used the wrong arguments to configure - I'll try again

perl Configure.pl --icushared="C:\usr\lib\icu\lib\icudt.lib C:\usr\lib\icu\lib\icuuc.lib" --icuheaders="C:\usr\lib\icu\include"

Did I say I was watching Heston at the moment? He's back at Little Chef. This may be slightly lost to readers out of the UK. Right. Advert break. Time to grab some stilton and biscuits.

hmm. nice stilton. Goes suprisingly well with this glass of white. Anyway - back to it. that resulted in the same error. I'll do a sanity check on the arguments. Look ok, now I noticed I had installed ICU4C - i'll try the "ICU 4.2" download instead. Ahh. notice I am trying to use 4.2.1 rather than 4.2 - I'll try installing that instead. damn. I've run out of stilton.

Ahhhh! Me being an eeedjit! Configured the environmental variables after opening the window - re added set C:\usr\lib\icu\bin to %PATH% and bingo!

And lets see...
C:\install\rakudo-2009-10>perl Configure.pl --parrot-config=c:\Parrot\bin\parrot _config.exe

Reading configuration information from c:\Parrot\bin\parrot_config.exe ...
Verifying Parrot installation...

===SORRY!===
I'm missing some needed files from the Parrot installation:
C:/Parrot/lib/parrot/1.7.0/languages/nqp/nqp.pbc
C:/Parrot/lib/parrot/1.7.0/tools/build/ops2c.pl
C:/Parrot/lib/parrot/1.7.0/tools/build/pmc2c.pl
C:/Parrot/src/parrot/1.7.0
C:/Parrot/src/parrot/1.7.0/pmc
C:/Parrot/include/parrot/1.7.0/pmc
(Perhaps you need to use Parrot's "make install-dev" or
install the "parrot-devel" package for your system?)

DOH! very nice error message though. I'll try install-dev.

That slipped in, and Configure.PL ran ok in the rakudo dir.

make ( well the mingw variant ) worked.... now running $make test

All tests successful.
Files=29, Tests=236, 146 wallclock secs ( 0.81 usr + 0.16 sys = 0.97 CPU)
Result: PASS

yay.

So it seems install. One thing left then.

I create a file, greet.pl, with the following content:
say "Hello world";
and lets try to run it ( making sure that perl6 is added to path this time ... ) and .....

Agggh! our friend the icuuc42.dll alert!. I hadn't added C:\usr\lib\icu\bin; to the global %PATH%! Easily fixed.

And, finally, largely due to my distracted state!:
C: ... \perl6>perl6 greet.pl
Hello world
yay!

Conclusions:

  • Focus on what you are doing - watching telly simultaneously isn't great
  • Follow the instructions in the parrot distro.
  • ICU seems important.
  • Be carefull about your environment variables.
Monday October 26, 2009
07:02 PM

Attempted dip into perl 6

Win 32 again. I am tempted to get a proper posix laptop of some kind or description but until then...

I sat down this afternoon to watch "The Last King of Scotland". As I have difficulty single-tasking I thought I might have another look at perl6 whilst it was on. Heres some of the notes I made.

Effective starting point:

http://www.perlfoundation.org/perl6/index.cgi?rakudo

points to:

http://perlgeek.de/blog-en/perl-6/where-rakudo-lives.writeback

Download parrot & install win32 - straightfoward.

Download Rakudo from:

http://github.com/rakudo/rakudo/downloads

Back then to the perlfoundation guide - it says "To build the Rakudo Perl 6 compiler,
  first get a working copy of Parrot and build Parrot. Then, once Parrot is built,
change to the languages/ subdirectory and obtain your copy of Rakudo there:"

I used the win32 installer, and upon changing into the parrot directory there doesn't
seem to be a languages subdir!

Ahhhhhh

Nothing quite like RTFM! -

http://rakudo.org/how-to-get-rakudo

That mentions the --gen-parrot method - however, i've just installed parrot so I'll
try to find another. The README file in the downloaded Rakudo directory seems to provide the answer:

--parrot-config=/path/to/parrot_config

Not too sure what "parrot_config" is though. I'll start with the "C:\Parrot-1.7.0" directory.

Doesn't work - try another - nope - should be more scientific. do some googling. Nope.

I'll try perl Configure.pl followed by dmake - nope. switch to suggested mingw32-make.

issues. maybe I should have stuck with the "perl Configure.pl --gen-parrot" varient.

I google: "parrot win32 rakudo --parrot-config"

http://perl.bristolbath.org/blog/lyle/2009/04/first-perl-6-experiences.html

hmmm. maybe I'll try --gen-parrot...

In file included from perl6_group.c:17: /Parrot-1.7.0/include/parrot/parrot/parrot.h:235:23: libintl.h: No such file or
directory
mingw32-make: *** [src\pmc\perl6_group.dll] Error 1

Hmm. maybe its worth returning to the Last King Of Scotland for its conclusion - next time maybe I'll try to build parrot devel locally and go from there...

Friday October 16, 2009
04:07 AM

The definitive Guide to Catalyst

After playing with catalyst for a little while, it has interested/excited me sufficiently to make a time/finance trade and invest in a book rather than relying on the power of the internet for guidence.

I've been "out of perl" for a few years now, and there appears to be two books aimed at catalyst out there now. After a little googling and swotting up on amazon, I stumbled across a review of "the definitive guide to catalyst" from the illustrious Dave Cross ( To stress - Dave reviewed the book - as far as I'm aware he didn't write it )

I've now owned this book for a whole 24 hours, so thought it worth sharing my first thoughts - I am very impressed. One of the features Dave mentioned was the books coverage/use of "Modern (or Enlightened) Perl" - I think its fair to say that all platforms have moved forward recently - I can't imagine people coding in java, for example, using the same techniques as was prevalent 10 years ago, so I was keen to see what has gone on in the perl world.

Little parts of the book - such as the page on minicpan are a godsend for me, the explanation of moose looks interesting, and whilst I haven't begun to digest the huge wealth of information contained within this tome, the style and depth of what I have gleamed thus far gives me a great deal of faith in my investment. If I had to choose a single feature about the book that appeals thus far, its that the authors appear to have managed to cover a massive subject area in a concise, well written manner that doesn't treat the reader as a fool or simpleton. Good levelling chaps!

I'll try to make some more notes after a couple of weeks or so when I've had the opportunity to study this work further.