Sunday 31 October 2010

Glasgow Perl Mongers, a couple months on

I blogged about creating the Glasgow Perl Mongers group some time ago; I feel it's time to talk about it again :)

First things first, the fine folks handling pm.org finally redirected the domain and made things official: glasgow.pm.org is now our site.
Thanks guys, we do owe you a couple beers!

We have had our first social and our first technical meeting, and we're heading into our second technical meeting, scheduled for November 11th. The aim of the group is to have recurring monthly technical meetings, possibly related to Perl.

On our first technical meetings we were joined by Aaron Crane of Edinburgh.pm fame, who gave his YAPC::EU 2010 talk "Perl on speed: multicore programming for mere mortals", available at http://aaroncrane.co.uk/talks/. I subsequently delivered a very long talk on "Life after 5.8.8", and a lightning talk on Leguminous (Git repos).

For our next monthly meeting, things are looking great: we'll have a talk on comparing Git and darcs, by Miles Gould, a talk about "Loops without loops: Ocaml and Perl as functional languages", by Chris Yocum and probably even another one on automatically compiling statically typeable portions of Perl scripts, by Wim Vanderbauwhede.

Things are looking great! If we keep up this pace, we'll surely have a good deal of talks every month!

Thanks again to mst for having said the right words and suggesting that yes, creating a Perl Mongers group in Glasgow was well within what I could do.

All, you're more than welcome to join us on our technical meetings ;) We do have a social meeting afterwards (Drinkers.pm) at a local pub as well.

Till soon,
-marco-

Thursday 26 August 2010

Resurrecting Glasgow.pm

During YAPC::EU mst suggested "why don't you just start Glasgow.pm?"

I talked about it a bit with a friend who'll be back in the country soon enough and even today at work, and I think we may have enough people to kickstart the new Perl mongers group.

I know there are several businesses and people in the West of Scotland who either use or like Perl, so I am hoping that enough of them would like to join the group.

I've sent the request to pm.org's support to reinstate the old Glasgow.pm. I will endeavour to bring the mailing list and website up as soon as possible, and will start reaching out to people who use Perl in the area. Dear lazyweb, could you help me?

In contrast with Edinburgh.pm's meetings, which are mostly "social" gatherings in the pub, I would like Glasgow.pm's meetings to be a bit more on the technical side. I am hoping we will be able to secure a good venue for that (crossing fingers!), and that we'll have enough people and interest to have a bunch of talks and lightning talks at each meeting.
Depending on what the consensus is, I think we may end up having a technical meeting one month, and one social meeting the next.

Please spread the word if you think somebody in the area may be interested in coming along, and feel free to contact me both on this blog and via e-mail at mfontani at cpan dot org.

Oh, and I'd be proposing the second tuesday of the month as the meeting's day (Edinburgh.pm's is the fourth Thursday -- tomorrow). This would allow people in either city to attend either meetings.

Wish me good luck! :)
-marco-

p.s. Visit glasgow.darkpan.com for the (temporary) website.

Tuesday 8 December 2009

Cloud laziness part 1: creating a CloudServers server instance

The following is ongoing on my private branch of the CPAN dist Net::RackSpace::CloudServers, in which I'm creating an App::Cmd interface to the module:


okram@bluedesk: (with_app_cmd)
~/GIT/Net-RackSpace-CloudServers$ perl cloudservers.pl create \
--name=mfapitest --imagename karmic --flavorname 256 --verbose
Server name: mfapitest
Metadata:
Paths:
Image id 14362 named Ubuntu 9.10 (karmic)
Flavor id 1 named 256 server
Creating new server...
Created server ID 124999
root password: mfapitestXXXXXXX
Public IP: 174.143.242.999
Private IP: 10.176.140.999
Server status: ACTIVE progress: 100..
Server now available!

The same is indeed doable with the sample scripts/newserver.pl in the dist -- and I also need to use scripts/deleteserver.pl to destroy the test instance -- but I assume that a command-line interface may be useful in the longer term to scale up/down specific instances, create N new servers in a shared IP group, or destroy no longer needed instances.


The command was pretty painless to write, and most of it was the validate_args routine...


As usual, comments would be much appreciated!

Till soon,

-marco-

Sunday 29 November 2009

Git - inhibit commit if modules don't compile

Sometimes I forget to run Perl base tests for my modules, before committing changes. As to what happens, I end up committing something that doesn't quite compile ;)

Luckily Git has a pre-commit hook one can use to run at least the "compile" tests.

The following aborts the commit if the t/00*.t tests (usually the "do all modules compile?" tests) in the repository don't run correctly:

~$ cat .git/hooks/pre-commit
#!/usr/bin/perl
# Runs modules' "compiles" tests before committing
# Dies (halting commit) if they don't compile
print "pre-commit => testing..\n";
do {qx{
prove -Ilib t/00*.t
}} or die <<'DIEMSG';
pre-commit => ERRORS:
$@
DIEMSG
print "pre-commit => test OK\n";


This is an example of a 00-load.t file, that can literally be dropped-in the t/ directory:

use strict;
use warnings;
use Test::More;
use File::Find::Rule;

my @files = File::Find::Rule->name('*.pm')->in('lib');
plan tests => ~ ~ @files;

for (@files) {
s/^lib.//;
s/.pm$//;
s{[\\/]}{::}g;

ok(
eval "require $_; 1",
"loaded $_ with no problems",
);
}


File::Find::Rule is one of the golden gems found on CPAN, rclamp++!

Till soon,
-marco-

Sunday 22 November 2009

CloudServers Perl module - 0.09_10

perl -E'say join " ", reverse world, hello' # :)


I've finally found some time to play again with the Rackspace API manual, and added a couple features to the Net-RackSpace-CloudServers module I hadn't touched since moving home some months ago.


The project is semi-alive on http://github.com/mfontani/Net-RackSpace-CloudServers/, and the latest 0.09_10 development version should be on CPAN soon.


It's basically a one-to-one adaptation of the Rackspace API document available at http://www.rackspacecloud.com/cloud_hosting_products/servers/api.


On the scripts/ directory there are some examples on how to use the module: it's possible to list all images, flavors, and servers you own, as well as delete servers by ID or create new servers in what I think is quite a simple syntax.


As an example, let's delete that pesky server whose ID's 666:

 
use strict; use warnings; use Net::RackSpace::CloudServers;
my $cs = Net::RackSpace::CloudServers->new(
user => $ENV{'CLOUDSERVERS_USER'},
key => $ENV{'CLOUDSERVERS_KEY'},
);
my @servers = $CS->get_server_detail;
my $srv_666 = ( grep { $_->id == 666 } @servers )[0];
die "No such server id 666\n" if ( !defined $srv_666 );
$srv_666->delete_server(); # dies in case of error
print "Server #666 deleted\n";


On a branch not on Github yet, I'm working on an App::Cmd interface to it, as well.


Any comments at all would be truly appreciated, as this is my first module I'm trying to get on CPAN ;)


Till soon,

-marco-