tomhukins's Journal http://use.perl.org/~tomhukins/journal/ tomhukins's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:14:55+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 tomhukins's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~tomhukins/journal/ Test counts and vim http://use.perl.org/~tomhukins/journal/40425?from=rss <p>My current favourite vim trick when writing tests in Perl is CTRL-A.</p><p>My tests contain a line near the top that looks like <code>use Test::More tests =&gt; 12</code> where my test suite has 12 tests. I move my cursor over the number 12 and type <code>mc</code> which sets a mark labelled "c" for test count.</p><p>Then, if I write 5 new tests, I type <code>`c</code> (backtick c) to jump to my test count, then <code>5 CTRL-A</code> to increment my test count by 5. Finally, <code>``</code> (2 backticks) takes me back to where I was last editing.</p><p>If I remove tests, I use CTRL-V instead of CTRL-A to decrement the test count.</p> tomhukins 2010-07-01T08:05:23+00:00 journal Using CPAN's Toolchain to Improve Your Code http://use.perl.org/~tomhukins/journal/39835?from=rss <p>I've given a talk on using the techniques as CPAN authors use in their public code in your private code twice this year: originally at <a href="http://miltonkeynes.pm.org/">Milton Keynes Perl Mongers</a> in April, then at <a href="http://yapceurope2009.org/ye2009/">YAPC Europe</a> in August.</p><p>And finally I have put <a href="http://miltonkeynes.pm.org/talks/2009/04/tom_hukins_cpan_toolchain.pdf">my slides</a> online!</p><p>I have noticed that most companies arrange their code in an unstructured way, and contrasted this to how CPAN arranges code as small distributions packaged with documentation and tests. I advocated the idea of taking this approach with other Perl code, even if it will never live on CPAN.</p><p>I got some useful feedback after my talk and had several interesing discussions about it at the conference. So I thought I would write up various extra ideas here.</p><p>I mentioned CPAN::Mini::Inject, but didn't know about CPAN::Inject, which works with a full CPAN mirror instead of a CPAN::Mini mirror. I also didn't know about CPAN::Site which does much the same. I don't know which circumstances each works best in.</p><p>I mainly focused on ExtUtils::MakeMaker and Module::Install for packaging modules together. I deliberately ignored Module::Build and didn't know about ExtUtils::ModuleMaker.</p><p>The DPAN project on CPAN looks like an ambitious approach to solving the issues I covered and much more too. I probably won't look at it until it has more documentation (I'm a bit of a late adopter), but I should keep an eye on it.</p><p>I was grateful for the advice of others who have tried the approaches that I mentioned, sometimes following more thoroughly than I have done. If you're breaking out your code base into lots of small CPAN-style modules, you might find judging the appropriate level of granularity awkward. Talk to your colleagues and don't rush to break things apart too early.</p> tomhukins 2009-11-03T20:27:07+00:00 journal Milton Keynes Perl Mongers Technical Meeting, April 2009 http://use.perl.org/~tomhukins/journal/38855?from=rss <p> Last Thursday, <a href="http://miltonkeynes.pm.org/">Milton Keynes Perl Mongers</a> held our second technical meeting of the year. How organised of us! </p><p> We had a typically varied, interesting set of talks, reflecting the different things we use Perl for. </p><p> Colin Bradford told us more about how <a href="http://miltonkeynes.pm.org/talks/2009/04/colin_bradford_memcached.pdf">Lovefilm used memcached</a> to scale their popular Perl Web applications for hundreds of thousands of users. Colin gave some interesting suggestions based on hard won experience. My favourite tip was "avoid using methods called 'set' and 'get' because you will mistype them and fail to spot mistakes in code reviews. Use 'store' and 'retrieve' instead." </p><p> Tony Edwardson gave a brief <a href="http://miltonkeynes.pm.org/talks/2009/04/tony_edwardson_moose_introduction.pdf">introduction to Moose</a>, which proved useful for our attendees who aren't die hard Perl developers, and offered a good overview for those of us who haven't done much with Moose yet. </p><p> I showed how developers can use CPAN's toolchain to develop and distribute their own private code. I chose not to use slides, and went for the live demo option which fortunately went fine. </p><p> Finally, Peter Edwards told us about <a href="http://perl.dragonstaff.co.uk/mkpm_wxwidgets.pdf">using WxWidgets to develop cross platform GUI applications in Perl</a>. The Padre Perl IDE has recently made this more popular: Peter told us about an older application he supports. I liked that he told us about supporting tools that might life easier without language bigotry: some of the most useful Wx tools are written in Python. </p><p> Unfortunately our meeting clashed with the <a href="http://use.perl.org/~acme/journal/38843">London Perl Mongers' technical meeting</a>, which affected a few people who wanted to attend both. Still, I consider this a good problem to have: We have several active Perl groups in England meeting regularly. </p><p> I'm currently organising our next set of talks some time in July. Please let me know if you would like to present a talk, or keep an eye on our Web site, mailing list or IRC channel if you would like to attend. </p> tomhukins 2009-04-23T10:22:16+00:00 journal Using Test::Deep with Test::Builder http://use.perl.org/~tomhukins/journal/38656?from=rss <p>I find Test::Deep very useful when writing tests. It's very handy for checking complicated data structures in all sorts of different ways.</p><p>Recently I wanted to use Test::Deep in my own Test::Builder test subclass. I discovered Test::Deep::NoTest which seemed useful: it lets me call functions from Test::Deep without them expecting to run directly within a test script themselves.</p><p>So, Test::Deep::NoTest and eq_deeply() looked like what I wanted. And they did a fine job, except when comparisons failed: I could find out that a comparison had failed, but not why.</p><p>After a brisk stroll through Test::Deep's source code and a quick chat with its author, I wrote a patch to expose and document its cmp_details() method. This lets you compare data structures and get a description of any differences, if they exist.</p><p>If you want to use Test::Deep within your own test class, download version 0.104 or newer of Test::Deep and see the new documentation on <a href="http://search.cpan.org/~fdaly/Test-Deep-0.104/lib/Test/Deep.pod#USING_TEST::DEEP_WITH_TEST::BUILDER">Using Test::Deep with Test::Builder</a>.</p> tomhukins 2009-03-17T14:50:23+00:00 journal Resuscitating Cambridge Perl Mongers http://use.perl.org/~tomhukins/journal/38589?from=rss <p><a href="http://cam.pm.org/">Cambridge Perl Mongers</a> held our first meeting in a while last night. Seven of us met in a pub and discussed all sorts of things - even a little Perl.</p><p>We plan to meet every month - next month's meeting will take place on April 1st.</p><p>Unfortunately, several people who might have attended didn't know about the meeting due to a recent mailing list migration. If you think you're on the list, it's worth <a href="http://cam.pm.org/list_signup.shtml">signing up</a> again. Hopefully, the old list's subscribers will soon find their way on to the new list automatically, but that hasn't happened yet.</p><p>Despite its low attendance, the meeting went well. We drank various beers with confusing TLA names like JHB and IVB. Thankfully I managed to avoid asking for IVF.</p><p>If you're anywhere near Cambridge and interested in Perl, please subscribe to the mailing list, join us in #cam.pm on <a href="http://irc.perl.org/">irc.perl.org</a> or join us in the pub next month.</p><p>We also plan to hold a technical meeting before long with various talks about Perl. It's all quite exciting.</p> tomhukins 2009-03-04T11:47:01+00:00 journal MiltonKeynes.pm Technical Meeting http://use.perl.org/~tomhukins/journal/38295?from=rss <p> <a href="http://miltonkeynes.pm.org/">Milton Keynes Perl Mongers</a> held our first meeting of 2009 on Tuesday. </p><p> Most of the meeting consisted of lightning talks where the speakers told us how they have used Perl to solve problems at the BBC, the Open University, Lovefilm and various investment banks. </p><p> We also heard about how the new online shop <a href="http://www.pennysarcade.co.uk/">Penny's Arcade</a> relies on Perl. </p><p> I have linked to the the speakers' slides from our Web site, so please take a look if you're interested in <a href="http://perl.jonallen.info/pub/Main/OnlineRetailWithPerl/Online_Retail_With_Perl.pdf">online retail with Perl</a>, <a href="http://miltonkeynes.pm.org/talks/2009/01/tony_edwardson_only.pdf">specifying module versions with only</a>, <a href="http://miltonkeynes.pm.org/talks/2009/01/rod_norfor_chart_gnuplot.pdf">Chart::Gnuplot</a>, <a href="http://miltonkeynes.pm.org/talks/2009/01/colin_bradford_memcached.pdf">memcached</a>, <a href="http://www.pennysarcade.co.uk/files/Creating_PDF_files_with_Catalyst.pdf">creating PDF files with Catalyst</a> or <a href="http://miltonkeynes.pm.org/talks/2009/01/peter_edwards_exceptions.pdf">exceptions and Perl</a>. </p><p> Please get in touch if you would like to present at one of our future meetings, or if you'd like to come along to watch the fun unfold. </p> tomhukins 2009-01-15T17:49:53+00:00 journal MiltonKeynes.pm Technical Meeting http://use.perl.org/~tomhukins/journal/34922?from=rss <p> I'd promised a <a href="http://miltonkeynes.pm.org/">Milton Keynes Perl Mongers</a> technical meeting for some time, and on Thursday we finally got round to holding one. </p><p> We've found that the Perl Mongers group has plenty in common with the local <a href="http://www.mk.lug.org.uk/">Linux User Group</a> so we decided to hold a joint technical meeting. We've had joint social meetings for several months. </p><p> The meeting started with Dave Cross, our guest speaker, giving an Introduction to the Template Toolkit. Dave did a great job of showing what TT does well. I'm already a fan, so I hope Dave prompted other listeners to discover its wonderfulness. </p><p> Adam Lowe told us about some of the projects he's working on at <a href="http://www.tnmoc.co.uk/">The National Museum of Computing</a> at Bletchley Park. They have some scarily huge machines - some of which work! - that can't even store an MP3 file on their tape drives. As Dave pointed out, this seems strange given that we used to store music on tapes not that long ago. Adam's talk made me want to revisit Bletchley Park and see what the Computing Museum people are up to. </p><p> Oliver Gorwits told us about Oxford University's network and how it works. There's lots of Perl, Linux and other open source in there, as you'd expect. I particularly like that <a href="http://search.cpan.org/dist/SNMP-Effective/">SNMP::Effective</a> plays a role in there, as Jan and Oliver have bounced around ideas for its development on the #miltonkeynes.pm IRC channel. </p><p> I've put all the slides online at <a href="http://miltonkeynes.pm.org/">http://miltonkeynes.pm.org/</a>. </p><p> Conveniently, we found a real ale festival after the talks. We enjoyed a few beers and met up with Tony, who hadn't been able to make the talks. </p><p> So, for a group that's just over two years old, I'm pleased with what we've done. I'm looking forward to some great meetings in 2008 with the regulars, our old friends (I'm expecting visits from Birmingham.pm and Matt Trout), and hopefully a few new visitors too. </p><p> It's also great to watch the open source community grow in the city where I live. It seems we have lots of people doing interesting things here, but mostly we're not talking to each other. We're slowly improving this. </p> tomhukins 2007-11-18T21:59:09+00:00 journal Pycon UK from a Perl Perspective http://use.perl.org/~tomhukins/journal/34387?from=rss <p> I hadn't been any conferences this year, so I thought I'd visit the first ever <a href="http://www.pyconuk.org/">Pycon UK</a> as it's nearby, in Birmingham, and I know almost nothing about Python. </p><p> So far the conference seems very well run: we have frequent coffee breaks, good Internet connectivity, talks keeping to schedule and a fairly tasty lunch. </p><p> Fortunately, I chose some interesting talks to attend this morning. It's always hard to know what you'll enjoy beforehand. </p><p> I started out in Paul Johnston's talk about <a href="http://www.sqlalchemy.org/">SQLAlchemy</a>, an ORM for Python. I've been hacking on DBIx::Class lately as my job involves lots of databases at the moment, so this area interests me. The issues Paul mentioned seemed very similar to those that DBIx::Class has tackled: don't issue too many queries; work well with pre-existing databases; build database schemas from code. </p><p> Paul also showed how to incorporate SQLAlchemy with a templating system, which reminded a little me of the talk I gave on Class::DBI at the London Perl Workshop in 2004. Apparently Python programmers have strong opinions about the different templating systems available, just like we do with Perl. </p><p> Next, Michael Foord showed how to run Python code in Web browsers using <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython">IronPython</a> (Python within<nobr> <wbr></nobr>.Net) and Microsoft's Silverlight, their competitor to Abode's Flash. I enjoyed this because I've not done any Web work for several months and I've never used<nobr> <wbr></nobr>.Net. The XAML definitions for Silverlight struck me as a little verbose. I imagine Microsoft expect you'll use some sort of IDE and never actually look at the code you generate. </p><p> Terry Jones's talk about representing and processing information had little technical content, but instead covered ideas about how we treat objects and attributes in the real world and in computing environments. For example, I can form an opinion about Birmingham and share that opinion without needing anyone's permission. In computing, we too often think of objects as having owners and permissions. Terry's ideas reminded me a little of a few years ago when I got excited by RDF and thought about metadata. We can regard any data as either data or metadata depending on our perspective: all data types intrinsically exist as both data and metadata, but we choose one description depending on how we model things. </p><p> Some of Terry's ideas, particularly personalised searching, reminded me of discussions I've had with Nigel Hamilton, the author of the <a href="http://trexy.com/">Trexy</a> search engine. I might have to play with Terry's <a href="http://marbl.es/">marbl.es</a> search tool when it goes live. </p><p> Finally, Michael Sparks talked about Managing Creativity. Michael mostly described how his colleagues at the BBC structure their project's Subversion repository to maximise creativity, experimentation and sharing. Essentially, all work goes in the repository: even if one developer considers something they made worthless, another developer might value it or part of it. As well as the traditional trunk and branch structure, each developer has a sketchbook where they put their experiments. Developers can view each others sketchbooks, but have no guarantee what state they will be in. Finally, you can't merge your own work onto the trunk. This struck me as a very good way to enforce peer review. </p><p> After lunch, I felt tired so I've sat in the sun and slept a little. I'm just about to head back for the lightning talks, and I'm looking forward to some interesting informal conversation over the conference dinner this evening. I have a place at the <i>Memory</i> table: each table has the name of a Python exception type. </p> tomhukins 2007-09-08T15:32:43+00:00 journal Missing the LPW http://use.perl.org/~tomhukins/journal/31866?from=rss <p>I've been looking forward to today's London Perl Workshop for ages. I've put together a talk, "Testing When You Don't Have Time", that I thought would fit well with the workshop's theme.</p><p>I felt really tired last night, so I went to bed early despite friends texting me, inviting me to the pub.</p><p>Today I woke up feeling rough. I've only just got up, as of 11am, and I can't face the journey down to London.</p><p>Until now I had spoken at every (well, both) London Perl Workshops, so it's a shame to miss this one at the last minute. I hope everything goes well for the organisers, speakers and attendees, and I hope to see everyone I'd looked forward to talking to soon.</p> tomhukins 2006-12-09T11:16:41+00:00 journal In-memory SQLite Databases http://use.perl.org/~tomhukins/journal/31457?from=rss <p> Like many people, I use <a href="http://search.cpan.org/dist/DBD-SQLite/">DBD::SQLite</a> in my unit tests so I don't need to rely on a live database. </p><p> I've been using <a href="http://search.cpan.org/dist/File-Temp/">File::Temp</a>::tempfile() to create temporary files for me use as SQLite database files. Yesterday, I noticed that <a href="http://rt.cpan.org/Public/Bug/Display.html?id=22702">tempfile() and DBD::SQLite don't play nicely together</a>. I could use tmpnam(), but as this doesn't create the temporary file a small race condition exists. </p><p> I discussed this with <a href="http://use.perl.org/~Matts/">Matts</a> last night and he pointed me towards SQLite's in-memory databases. My test cases don't use huge amounts of data, so I can run everything in memory and avoid hitting the disk: </p><p> <code> DBI-&gt;connect('dbi:SQLite:dbname=:memory:', '', ''); </code> </p><p> This means I don't need to bother with temporary files any more, making my tests simpler and faster. </p> tomhukins 2006-10-31T12:36:31+00:00 journal Another Wonderful MiltonKeynes.pm Tech Meet http://use.perl.org/~tomhukins/journal/31287?from=rss <p> We held our third technical Perl Mongers meeting this evening. I enjoyed it and learned things. Great! I suspect I'll put the slides on <a href="http://miltonkeynes.pm.org/">our web site</a> once I've caught up with some sleep. </p><p> Lee started out by telling us how he uses Perl in his work as a bioinformatician. Nik noticed that anti-spam code uses some of the techniques he described, which made me think a little about evolution and spammers. Lee had very detailed slides that supported his talk well. </p><p> Robbie told us about the fun and pitfalls of running an online game. He explained how he used HTML::Template to let players customise their in-game views; he told us how he used<nobr> <wbr></nobr>.htaccess files to protect Wikis and forums from spam. But best of all he showed us logs of what happens if you <code>s/\bgay\b/hard/</code> on a messaging system used by frustrated teenagers. </p><p> Then we took a quick break to chat to each other before I waffled about things I learned at YAPC:Europe. Well, some of them, at least. I forgot to mention the Chartreuse and making people miss their flights home. </p><p> Finally, Nik gave us a great introduction to SVK. Unfortunately, my clever idea of him pulling out the network cable to work offline couldn't happen as he had an SSH connection open to the machine at the other end of the cable. By now I should have learned that my clever plans don't work. </p><p> But we had fun. And I guess it's more or less our first birthday now as a Perl Mongers group. I'm still surprised we can draw this kind of audience for Perl in Milton Keynes, but really pleased that our group does so well. </p><p> And as Jonas says, "MiltonKeynes.pm sounds more like a solicitors firm than any other Perl Monger group." I choose to take that as praise.. </p> tomhukins 2006-10-10T23:44:53+00:00 journal Stopping PPM SAX Warnings http://use.perl.org/~tomhukins/journal/29857?from=rss <p> For my sins, I look after ActivePerl installations on several Windows machines including my desktop machine at work. If you don't sin enough to use Windows, the following won't interest you much. </p><p> Read on if you use PPM and regularly encounter error messages like: </p><blockquote><div><p>Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePerl/EncodingDetect.pm line 96, line 251.<br> Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePerl/EncodingDetect.pm line 96, line 265.<br> Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePerl/EncodingDetect.pm line 96, line 274.<br> Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePerl/EncodingDetect.pm line 96, line 279.<br> Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePerl/EncodingDetect.pm line 96, line 287.</p></div> </blockquote><p> Version 0.13 of <a href="http://search.cpan.org/dist/XML-SAX/">XML::SAX</a> introduced a rewrite of the pure Perl SAX parser. This parser has behaved <a href="http://www.cpanforum.com/threads/1473">awkwardly</a> for a few people: I've noticed it when using PPM on machines with <a href="http://search.cpan.org/dist/XML-SAX-Writer/">XML::SAX::Writer</a> installed. </p><p> After a quick nose through the documentation for XML::SAX::ParserFactory, I installed <a href="http://search.cpan.org/dist/XML-SAX-Expat/">XML::SAX::Expat</a> through PPM. I then taught XML::SAX to use this parser instead of the whingeing XML::SAX::PurePerl parser by putting the following line in <tt>C:\Perl\site\lib\SAX.ini</tt>: </p><blockquote><div><p> <tt>ParserPackage = XML::SAX::Expat</tt></p></div> </blockquote><p> PPM now complained about a missing ParserDetails.ini, so I created an empty file at <tt>C:\Perl\site\lib\XML\SAX\ParserDetails.ini</tt>. </p><p> I feel a little guilty about avoiding the problem with a quick hack rather than creating an elegant solution. On the other hand, PPM doesn't spew errors out at me, so I laze around in the sun drinking. Errrr, I mean get on with other mission critical business tasks... </p> tomhukins 2006-06-09T14:06:59+00:00 journal Talks and Slides http://use.perl.org/~tomhukins/journal/29121?from=rss <p> It's almost two weeks since our first MiltonKeynes.pm technical meeting and I've finally got round to putting the slides on <a href="http://miltonkeynes.pm.org/">our Web page</a>. </p><p> We got a respectable attendance: ten people showed up including the four speakers. The speakers covered a good variety of topics from Nik's talk about <a href="http://miltonkeynes.pm.org/talks/2006/03/nik_clayton_testing_legacy_code.pdf">Testing Legacy Code</a>, using clever tricks like overriding CORE::GLOBAL from within modules to affect how scripts run, through Dave's <a href="http://miltonkeynes.pm.org/talks/2006/03/dave_cross_databases_and_perl/">Databases and Perl</a>, covering DBI and Class::DBI with good explanations of problems you might encounter, and my <a href="http://miltonkeynes.pm.org/talks/2006/03/tom_hukins_www_mechanize.pdf">Gathering information from the Web with WWW::Mechanize</a> to Rod's talk (no slides) about using Perl to tie together a variety of large systems. </p><p> The range of talks did justice to Perl's versatility and power: you can override its internals, hook into databases and Web sites easily, or use it as the Internet's duct tape with a few convenient scripts. </p><p> It's funny how time flies: tomorrow we're off to the pub again. </p><p> For a small city, not known for its computing industry, we're doing well enough to provoke London.pm into holding a long overdue <a href="http://use.perl.org/article.pl?sid=06/03/09/1317233">technical meeting</a>. In a moment of weakness, Dean persuaded me to talk at that, too. </p><p> So I gave a lightning talk on <a href="http://london.pm.org/tech_talks/2006-03-23/tom_hukins-tracing_code_with_aspect_pm.pdf">Tracing Code with Aspect.pm</a> which <a href="http://happygiraffe.net/blog/archives/2006/03/24/london-pm-tech-meet">Dominic Mitchell has summarised well</a>. From the other talks, I learned a bit about OCaml and JSON both of which have lingered on my <em>things to learn about</em> list for too long. </p><p> This evening, I found myself fixing a Postfix installation on a Fedora box using yum. I've used none of these before, but still managed to get everything working. I didn't do this out of the goodness of my heart, though: I did it to guilt trip Robbie into talking about how he uses Perl to run a multiplayer game in his spare time at the next MiltonKeynes.pm technical meeting. Watch this space. </p> tomhukins 2006-03-27T22:20:31+00:00 journal HTML::Tidy Revelation http://use.perl.org/~tomhukins/journal/27445?from=rss <p> In the WWW::Mechanize talk I gave at this year's YAPC::Europe and NPW, I describe how I have passed invalid HTML through the command line tool <a href="http://tidy.sourceforge.net/">tidy</a> before passing it to XML::LibXML to process. </p><p> I mention that I don't use <a href="http://search.cpan.org/dist/HTML-Tidy/">HTML::Tidy</a> because it doesn't actually clean the HTML, it just checks for warnings. At least, that's what I thought. </p><p> Robbie, who I work with, has just showed me some code where he calls <a href="http://search.cpan.org/~petdance/HTML-Tidy-1.06/lib/HTML/Tidy.pm#clean(_$str_%5B,_$str...%5D_)">clean</a> to do this. In my defence, the documentation confused me by saying this method returns true, whereas it actually returns the cleaned content, which happens to evaluate to true. I should get into the habit of reading documentation on AnnoCPAN, which <a href="http://www.annocpan.org/~PETDANCE/HTML-Tidy-1.06/lib/HTML/Tidy.pm#note_36">mentions this</a>. </p><p> I hope I haven't encouraged too many people to use a separate process to do something a CPAN module already does. The module's name makes its purpose clear enough. </p><p> Whoops! </p> tomhukins 2005-11-04T14:09:26+00:00 journal My Recent Perl Events (Or: Perl Without Programming) http://use.perl.org/~tomhukins/journal/27408?from=rss <p> I gave a couple of talks at the Nordic Perl Workshop a week and a half ago, organised the first Milton Keynes Perl Mongers meeting last week, and there's a London.pm social on Thursday. </p><p> I really enjoyed the Nordic Workshop. I agree with <a href="http://use.perl.org/~jonasbn/journal/27358">jonasbn's comments</a>: having a single track with around forty atendees worked well. </p><p> Both my talks went well. As I get more practice speaking I find myself feeling more confident and relaxed. The audience laughed at my jokes and asked good questions. Even without bribery. </p><p> Our first <a href="http://miltonkeynes.pm.org/">MiltonKeynes.pm</a> social meeting took place last Thursday and <a href="http://flickr.com/photos/tomhukins/56707523/">five of us showed up</a>. Not bad for a first attempt. </p><p> Then there's the London.pm social in two days. I should go because I've missed the last few and haven't seen everyone for a while. </p><p> It's easy to forget I started using Perl to write code when I've ended up speaking, organising meetings and using it as an excuse to go to the pub. Even at work, I've found myself spending more time organising and writing up meetings, determining requirements and talking to people than writing code. I guess I'll keep going with the flow and see where it all ends up. </p> tomhukins 2005-11-01T22:02:01+00:00 journal Let The Wild Rumpus Start! http://use.perl.org/~tomhukins/journal/27158?from=rss <p> Dear Neglected Journal, </p><p> Since I last wrote I have done many things. Here, I should just mention that I went to Portugal and enjoyed a mostly-wonderful YAPC::Europe. </p><p> Somehow I've ended up agreeing to give twice the number of talks I offered at the Nordic Perl Workshop. </p><p> But you don't care about that. You want to know what you would do if you ever found yourself as a Perl monger stranded half way between London and Birmingham in England. </p><p> Naturally, you would join the fresh, new <a href="http://miltonkeynes.pm.org/">Milton Keynes Perl Mongers</a> group. We're officially Buckinghamshire's most friendly, exciting Perl group. </p><p> We'll do the usual things: learning lots about Perl while enjoying ourselves. Join us! </p><p> Satisfaction guaranteed, or we'll refund your free subscription. </p> tomhukins 2005-10-13T23:19:10+00:00 journal Sigils and Definite Articles http://use.perl.org/~tomhukins/journal/23050?from=rss <p>Once upon a time, when I started using arrays in Perl, I found myself wanting to write things like <code>my $house = @street[87]</code>. It took me a while to understand that I should use a scalar, <code>$street[87]</code>, instead of an array slice, <code>@street[87]</code>. I felt that as I was dealing with an array, I should use the <code>@</code> sigil.</p><p>I've noticed others making the same mistake, and I've had trouble helping others learn the difference between <code>@</code> and <code>$</code> in this context. In English, we might translate <code>my $house = $street[87]</code> to <em>my house is the 87th on the street</em>. Or rather the 88th house if we count from zero, but that's another story for another day.</p><p>So, the <code>$</code> in <code>$street</code> shares its meaning with the word <em>the</em> in English. If I also own the house next door, I should use an array slice to say <code>my @houses = @street[87, 89]</code>. Or in English, <em>my houses are the 87th and 89th on the street</em>. The <code>@</code> in <code>@street</code> also translates to <em>the</em>. This doesn't help me understand the problem.</p><p>Translating this to French, or any language that inflects definite articles, provides a clearer understanding. Unless I'm horribly out of practice, we use <em>la 87&#232;me</em> for <em>the 87th</em> and <em>les 87&#232;me et 89&#232;me</em> for <em>the 87th and 89th</em>. Just as French uses <em>la</em> (or <em>le</em>) for the singular and <em>les</em> for the plural, Perl uses <code>$</code> for the singular and <code>@</code> for the plural.</p><p>I've understood the linguistic concept of inflecting pronouns for over fifteen years, and the difference between Perl's array slices and scalars for almost ten, yet I'd never equated the two. Now that I've written this down it all seems so obvious.</p><p>I wonder whether native French speakers find this Perl idiom easier to grasp, and whether speakers of languages that don't use definite articles would prefer a programming language that lacks sigils.</p> tomhukins 2005-02-06T19:23:09+00:00 journal Asking for Feedback http://use.perl.org/~tomhukins/journal/21080?from=rss <p>Just over a couple of weeks ago, I gave a talk about <a href="http://belfast.yapc.org/wiki/index.cgi?RunningWebBusinessWithPerl">Running a Web business with Perl</a> to London.pm <a href="http://use.perl.org/~2shortplanks/journal/20816">as 2shortplanks has already mentioned</a> in preparation for YAPC::Europe.</p><p>The talk went alright, and as a consequence I feel I delivered it much better in Belfast the week after.</p><p>I started out by introducing my talk and explaining that I was practicing for YAPC. I asked the attendees to let me know what they thought afterwards, as any feedback would help me do a better job the week after. I deliberately mentioned that I wanted both positive and negative feedback, as any opinions would help me improve.</p><p>Wow! I got some wonderful feedback from several people, who provided lots of encouragement and insight, pointed out my weaknesses and suggested improvements I could make.</p><p>I managed to incorporate some, but not enough, of these improvements before Belfast. Still, I have plenty of useful ideas to bear in mind for the future.</p><p>So, I wonder what to do: Should I always ask for feedback or will this make me seem unprepared? Perhaps it depends on the occasion. Regardless, I have plenty of things to think about for the next few talks I give.</p><p>How should I respond to others' talks? I don't want to seem rude by offering unwanted criticism, but I don't want to hold back opinions that might prove useful. Maybe it's all about diplomacy and tact, skills that all programmers have in abundance. Oh, wait a minute..</p><p>Finally, I don't want to suggest that I didn't get any feedback in Belfast. I got some very satisfying responses but, as I hadn't asked for it, less insightful criticism and suggestions for improvement. Anyone?</p> tomhukins 2004-09-27T21:13:28+00:00 journal Catching Up http://use.perl.org/~tomhukins/journal/20641?from=rss <p>It's some time since I've written to my journal, so I thought I should catch up with it and mention the (few) Perl-related things I've done since last time.</p><p>My last job didn't work out - although I did some interesting things with Class::DBI, Template Toolkit and Subversion - so for the last four weeks I've been commuting into London. It's been fun but tiring. I've discovered that I find commuting harder than I expected.</p><p>I gave a lightning talk on Class::DBI and wizard interfaces to London.pm in July, which described using a series of subclasses, each with more functionality, to model the evolution of objects through a wizard interface. You can construct an object using any class in the series, which automatically reblesses the object according to the amount of information currently known about it.</p><p>A few people I talked to seemed sceptical about this idea: Why bother reblessing things instead of using one class and checking parameters? I think the best answer is that you can map interfaces to the series of classes. Rather than having to perform tests against an object to see which stage of the interface to display, you can display the interface associated with a particular class.</p><p>I hope to write this up coherently at some point, ideally abstracting the code as a CPAN module. It's all a matter of time, or the lack of it.</p><p>Lastly, I've almost finished writing my paper for this year's YAPC::Europe. It's overdue, which is frustrating, but I've felt too tired to give it the attention it deserves until this weekend. I'm going to practice it at London.pm's technical meeting on 9th September. It's turned out more Webby than Perly, but I think it's still relevant for people working in both these areas. Perl developers who have no interest in the Web will find it very dull, though.</p> tomhukins 2004-08-30T20:19:41+00:00 journal New Job http://use.perl.org/~tomhukins/journal/17447?from=rss <p>I've just started the second week of my new job after a couple of months split between taking things easy and applying for jobs.</p><p>I had a few thorough interviews, which taught me a few things about myself that I hadn't considered too carefully. Apart from that, I spent my time doing very little, very slowly. I had planned to do all sorts of things after my previous job ended, but did none of them. As a consequence, I feel very well.</p><p>I also planned to move somewhere different and assumed fate would drag me to London. I ended up accepting a job in Bletchley, nearer to my house than anywhere I've ever worked (apart from when I was self-employed and only had to climb the stairs each morning).</p><p>Didn't someone else once write about discarding your initial plans?</p><p>So far, accepting this job seems like a good move. My first task is to rewrite some LAMP code of the worst sort: Red Hat, PHP, MySQL. I'd forgotten how awkward I found RPM to work with, and PHP really is as ill conceived as I suspected. I suggested that rewriting should involve FreeBSD, Perl and Postgres, and that's what we've decided to do. I've suggested we contribute some of our work back to the open source community, and this seems approved of. Fingers crossed.</p><p>So, we built a new development server this afternoon, having bought the parts late on Friday. The contrast of working in a small company (there are 5 of us) to a lazy, disorganised bureaucracy (as opposed to 7,000 of us) has really cheered me up. My previous employer didn't officially use Perl, yet I still used it to get my job done on time. One of my colleagues used XML::Twig to deal with a legacy database with 250,000 users, but I haven't a clue what his managers think he uses. You've heard this story before. My point is that I appreciate the change.</p><p>Unfortunately we listen to Radio 2 (for those who don't know: dull) in the office, but I'm sure I remember it being much worse. I suspect this shows I'm aging. It's mostly tolerable, occasionally good. Not the typical nu meejah thang.</p><p>So far, the most important thing I've learnt from my job is that Felix cat food in Scandinavia is called Pussi. I suspect knowing this might help avoid various embarrassing situations.</p> tomhukins 2004-02-17T00:49:28+00:00 journal Presentations http://use.perl.org/~tomhukins/journal/15706?from=rss <p>I gave a talk on XML &amp; Perl to our XSLT SIG at work this afternoon. I covered the usual stuff: plenty of modules to choose from, TIMTOWTDI, ways to solve different problems, different modules, etc. As the group mostly cares about XSLT, I mentioned <a href="http://search.cpan.org/dist/XML-LibXSLT/">XML::LibXSLT</a> and <a href="http://search.cpan.org/dist/Template-Plugin-XML-LibXML/">Template::Plugin::XML::LibXML</a> which I really like because it has the powerful bits of XSLT (XPath) without the complication. Besides, the more I think about templating, the more I like Template Toolkit, but that's another story for another day.</p><p>Roughly 10 people attended, which is a comfortable number for an informal presentation. Most of my colleagues prefer Java, but they largely seemed interested in how Perl can work with XML and asked some good questions afterwards. I didn't directly ask anyone what they thought of my talk, and nobody directly told their opinion, but I think it went well. At least, they seemed keen for me to give a talk on RSS in January.</p><p>On reflection, I realised I've given quite a few talks lately, so I decided I should try to draw some conclusions.</p><p>I've talked about Web templating at YAPC::Europe and Birmingham.pm, teaching Perl at London.pm, XML &amp; Perl at work, and I've been involved in a couple of best practice groups at work, where I've been vocal and had to present my ideas in much the same way as giving a talk: describing things without the details, but with enough explanation as to make sense. I've also been teaching Perl to a beginner (hence the London.pm talk) which reinforces this.</p><p>The main thing I've learned is something I already knew: there's no substitute for experience. I always observe the audience as I talk, whether I'm giving a talk or involved in a discussion. It's important to let the audience guide you, but not too much. I think I've been guilty of inadvertantly rushing talks or prolonging them depending on how people respond. It's important to react to your audience, but you need to remember each audience differs. If you talk to London.pm in a pub, you know you'll have more audience involvement and feedback than if you talk to a quieter group of people. So, it's important to gauge each group's response relative to its normal behaviour.</p><p>I know I'm neither a great Perl programmer, nor a great communicator, but discovering that I'm good enough at both to deal with presenting programming in various ways is satisfying. Interestingly, I hadn't planned to teach, speak or advocate best practice - all this just happened.</p><p>I'm wary of concluding anything meaningful from all this, so I'll keep my conclusion simple: it's been fun.</p> tomhukins 2003-11-11T21:47:38+00:00 journal Pre-empting CPAN http://use.perl.org/~tomhukins/journal/14001?from=rss <p>At last night's London.pm birthday party, I somehow ended up discussing Acme::Current with <a href="http://use.perl.org/~2shortplanks/">2shortplanks</a>.</p><p>Mark mentioned an uncommitted patch he submitted Acme::Current that means the code to the module doesn't need updating daily, but still requires daily installation. Of course, you should never patch an Acme module to behave sensibly, in this case just report today's date.</p><p>We then got onto silly ideas about subclassing the module, to do things such as report tomorrow's date, and something sick involving $0 that I don't remember properly.</p><p>So, as I browse through today's additions to CPAN, I notice <a href="http://search.cpan.org/author/JESSE/Acme-Current-Forever/">Acme::Current::Forever</a> and <a href="http://search.cpan.org/author/CORUSCATE/Acme-CurrentYesterday/">Acme::Current::Yesterday</a>.</p><p>It fascinates me that people in close communities often come up with similar ideas at roughly the same time: zeitgeists and all that...</p><p>A while ago, I tried explaining the idea of Acme modules to non-Perl people, including non-programmers. I don't think anyone quite understood, including me.</p> tomhukins 2003-08-08T17:35:20+00:00 journal