tag:blogger.com,1999:blog-2910777273244654432024-03-08T07:55:57.464-08:00Perl slicesSlice, splice, map, grep, whatever's Perl-marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-291077727324465443.post-13877669754374700382010-10-31T09:55:00.000-07:002010-10-31T09:55:06.692-07:00Glasgow Perl Mongers, a couple months onI blogged about creating the <a href="http://glasgow.pm.org">Glasgow Perl Mongers</a> group some time ago; I feel it's time to talk about it again :)<br />
<br />
First things first, the fine folks handling <a href="http://pm.org">pm.org</a> finally redirected the domain and made things official: <a href="http://glasgow.pm.org">glasgow.pm.org</a> is now our site.<br />
Thanks guys, we do owe you a couple beers!<br />
<br />
We have had our first social and our first technical meeting, and we're heading into our second technical meeting, scheduled for <a href="http://glasgow.pm.org/meetings/2010-11-11.html">November 11th</a>. The aim of the group is to have recurring monthly technical meetings, possibly related to <a href="http://www.perl.com">Perl</a>.<br />
<br />
On our first technical meetings we were joined by <a href="http://aaroncrane.co.uk/">Aaron Crane</a> of <a href="http://edinburgh.pm.org">Edinburgh.pm</a> fame, who gave his YAPC::EU 2010 talk "Perl on speed: multicore programming for mere mortals", available at <a href="http://aaroncrane.co.uk/talks/">http://aaroncrane.co.uk/talks/</a>. I subsequently delivered a very long talk on "<a href="http://is.gd/g4Vg2">Life after 5.8.8</a>", and a lightning talk on <a href="http://is.gd/g4VlZ">Leguminous</a> (<a href="http://github.com/mfontani/Leguminous">Git repos</a>).<br />
<br />
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 <a href="http://homepages.inf.ed.ac.uk/v1cyocum">Chris Yocum</a> and probably even another one on automatically compiling statically typeable portions of Perl scripts, by Wim Vanderbauwhede.<br />
<br />
Things are looking great! If we keep up this pace, we'll surely have a good deal of talks every month!<br />
<br />
Thanks again to <a href="http://www.trout.me.uk/">mst</a> for having said the right words and suggesting that yes, creating a Perl Mongers group in Glasgow was well within what I could do.<br />
<br />
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.<br />
<br />
Till soon,<br />
-marco--marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.com0tag:blogger.com,1999:blog-291077727324465443.post-68168309625712353492010-08-26T15:58:00.000-07:002010-08-26T15:58:35.220-07:00Resurrecting Glasgow.pmDuring YAPC::EU mst suggested "why don't you just start Glasgow.pm?"<br />
<br />
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.<br />
<br />
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.<br />
<br />
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?<br />
<br />
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.<br />
Depending on what the consensus is, I think we may end up having a technical meeting one month, and one social meeting the next.<br />
<br />
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.<br />
<br />
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.<br />
<br />
Wish me good luck! :)<br />
-marco- <br />
<br />
p.s. Visit <a href="http://glasgow.darkpan.com">glasgow.darkpan.com</a> for the (temporary) website.-marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.com0tag:blogger.com,1999:blog-291077727324465443.post-88161025650865920942009-12-08T01:04:00.000-08:002009-12-08T01:05:11.508-08:00Cloud laziness part 1: creating a CloudServers server instance<p>The following is ongoing on my private branch of the CPAN dist <a href="http://search.cpan.org/dist/Net-RackSpace-CloudServers/">Net::RackSpace::CloudServers</a>, in which I'm creating an <a href="http://search.cpan.org/dist/App-Cmd/">App::Cmd</a> interface to the module:</p><br /><pre>okram@bluedesk: (with_app_cmd)<br />~/GIT/Net-RackSpace-CloudServers$ perl cloudservers.pl create \<br /> --name=mfapitest --imagename karmic --flavorname 256 --verbose<br />Server name: mfapitest<br />Metadata: <br />Paths: <br />Image id 14362 named Ubuntu 9.10 (karmic)<br />Flavor id 1 named 256 server<br />Creating new server...<br />Created server ID 124999<br />root password: mfapitestXXXXXXX<br />Public IP: 174.143.242.999<br />Private IP: 10.176.140.999<br />Server status: ACTIVE progress: 100..<br />Server now available!<br /></pre><br /><p>The same is indeed doable with the sample <a href="http://cpansearch.perl.org/src/MFONTANI/Net-RackSpace-CloudServers-0.09_20/scripts/newserver.pl">scripts/newserver.pl</a> in the dist -- and I also need to use <a href="http://cpansearch.perl.org/src/MFONTANI/Net-RackSpace-CloudServers-0.09_20/scripts/deleteserver.pl">scripts/deleteserver.pl</a> 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.</p><br /><p>The command was pretty painless to write, and most of it was the validate_args routine... </p><br /><p>As usual, comments would be much appreciated!<br /><br />Till soon,<br /><br />-marco-</p>-marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.com0tag:blogger.com,1999:blog-291077727324465443.post-22010514045388935622009-11-29T07:41:00.001-08:002009-11-29T07:47:27.256-08:00Git - inhibit commit if modules don't compileSometimes 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 ;)<br /><br />Luckily Git has a pre-commit hook one can use to run at least the "compile" tests.<br /><br />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:<br /><br /><code><pre>~$ cat .git/hooks/pre-commit<br />#!/usr/bin/perl<br /># Runs modules' "compiles" tests before committing<br /># Dies (halting commit) if they don't compile<br />print "pre-commit => testing..\n";<br />do {qx{<br /> prove -Ilib t/00*.t<br />}} or die <<'DIEMSG';<br />pre-commit => ERRORS:<br />$@<br />DIEMSG<br />print "pre-commit => test OK\n";</pre></code><br /><br />This is an example of a 00-load.t file, that can literally be dropped-in the t/ directory:<br /><br /><code><pre>use strict;<br />use warnings;<br />use Test::More;<br />use File::Find::Rule;<br /> <br />my @files = File::Find::Rule->name('*.pm')->in('lib');<br />plan tests => ~ ~ @files;<br /> <br />for (@files) {<br /> s/^lib.//;<br /> s/.pm$//;<br /> s{[\\/]}{::}g;<br /> <br /> ok(<br /> eval "require $_; 1",<br /> "loaded $_ with no problems",<br /> );<br />}</code></pre><br /><br /><code>File::Find::Rule</code> is one of the golden gems found on CPAN, rclamp++!<br /><br />Till soon,<br />-marco--marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.com1tag:blogger.com,1999:blog-291077727324465443.post-85085770758211121792009-11-22T10:38:00.000-08:002009-11-22T10:40:10.137-08:00CloudServers Perl module - 0.09_10<p><code class="prettyprint">perl -E'say join " ", reverse world, hello' # :)</code></p><br /><p>I've finally found some time to play again with the <a href="http://www.rackspacecloud.com/">Rackspace</a> API manual, and added a couple features to the <tt>Net-RackSpace-CloudServers</tt> module I hadn't touched since moving home some months ago.</p> <br /><p>The project is semi-alive on <a href="http://github.com/mfontani/Net-RackSpace-CloudServers/">http://github.com/mfontani/Net-RackSpace-CloudServers/</a>, and the latest 0.09_10 <i>development</i> version should be on CPAN soon.</p> <br /><p>It's basically a one-to-one adaptation of the Rackspace API document available at <a href="http://www.rackspacecloud.com/cloud_hosting_products/servers/api">http://www.rackspacecloud.com/cloud_hosting_products/servers/api</a>.</p> <br /><p>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.</p><br /><p>As an example, let's delete that pesky server whose ID's 666:<br /><pre class="prettyprint"> <br /> use strict; use warnings; use Net::RackSpace::CloudServers;<br /> my $cs = Net::RackSpace::CloudServers->new(<br /> user => $ENV{'CLOUDSERVERS_USER'},<br /> key => $ENV{'CLOUDSERVERS_KEY'},<br /> );<br /> my @servers = $CS->get_server_detail;<br /> my $srv_666 = ( grep { $_->id == 666 } @servers )[0];<br /> die "No such server id 666\n" if ( !defined $srv_666 );<br /> $srv_666->delete_server(); # dies in case of error<br /> print "Server #666 deleted\n";<br /></pre></p><br /><p>On a branch not on Github yet, I'm working on an <tt>App::Cmd</tt> interface to it, as well.</p><br /><p>Any comments at all would be truly appreciated, as this is my first module I'm trying to get on CPAN ;)</p><br />Till soon,<br /> <br />-marco--marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.com0