pdcawley's Journal http://use.perl.org/~pdcawley/journal/ pdcawley'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:02:15+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 pdcawley's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~pdcawley/journal/ Hmm... it's been a while http://use.perl.org/~pdcawley/journal/31072?from=rss <p>Just in case you've been trying to use that old blog url, my blog's now at http://www.bofh.org.uk/ as the good lord intended.</p> pdcawley 2006-09-21T14:49:32+00:00 journal Hmm... http://use.perl.org/~pdcawley/journal/13545?from=rss <p>MovableType is rather lovely isn't it?</p><p>I appear to have done the awful thing and got myself a new movable type weblog, at the truly atrocious URL of <a href="http://pc1.bofhadsl.ftech.co.uk:8080/">http://pc1.bofhadsl.ftech.co.uk:8080/</a>. There's something about being in control that I like...</p> pdcawley 2003-07-18T23:39:12+00:00 journal Mmm... nice... http://use.perl.org/~pdcawley/journal/12853?from=rss <p>So, when a member of the family says, "You <em>must</em> stay at the Biltmore when you come to Miami!", and arranges a family rate for you, I suggest you take their advice.</p><p>I'm typing this from an executive suite in the aforementioned hotel and it's lovely. Switching to dorms for a couple of nights during YAPC is going to be something of a comedown let me tell you.</p><p>Oh yes, the journey was horrible. Last time I believe the BA website and troll off to terminal 4 to be told that the Miami flight is the only BA flight to leave from Terminal 3. And it's a bloody good job I brought the 'useless' tickets along (we'd booked on e-tickets, so the bits of paper that showed up the day before we left home seemed somewhat extraneous...).</p> pdcawley 2003-06-15T01:42:32+00:00 journal How did that happen? http://use.perl.org/~pdcawley/journal/11187?from=rss <p>I appear to have acquired a <a href="http://pdcawley.livejournal.com/">livejournal account</a>, where I'm now blogging nontechnical stuff, posting photos and that kind of thing. In other news I've failed to have any talks accepted for OSCON, and I've ordered a 17" G4 Powerbook.</p> pdcawley 2003-03-23T22:56:57+00:00 journal Road Trip!!! http://use.perl.org/~pdcawley/journal/10175?from=rss <p>So, I just went through the<nobr> <wbr></nobr>.com rite of passage and got downsized, but I'm not down about it. I'm hoping to get some freelance writing gigs and maybe the odd consulting day (but I'm <em>so</em> not banking on that consulting thing) and, what with one thing and another we should be okay.</p><p>But, it means Gill and I actually have some time on our hands. And Gill has her newly discovered big sister in Michigan. And YAPC's in Boca in June. And TPC is in Portland in July. And...</p><p>ROAD TRIP!</p><p>The only thing that's planned so far are the start and end dates (and places), at least one of the intermediate destinations, and a plan to spend some time in the Appalacians in search of some real(ish) mountain music.</p><p>If anyone can offer a bed for a night or two for a couple of Brits doing Boca-&gt;Michigan-&gt;Portland with laptop, view camera and rental car I'd be really pleased to hear about it.</p> pdcawley 2003-01-24T22:23:41+00:00 journal How did that happen? http://use.perl.org/~pdcawley/journal/9865?from=rss <p>I appear to be the proud owner of a Palm Tungsten|T. I only went looking for an adaptor so I could get my IIIx working with the TiBook.</p><p>Meanwhile I'm having bad thoughts about using some of Pixie's magic, allied with overloading bless type tricks to implement full on garbage collection for arbitrary objects in Perl 5. But that's for another day I think.</p> pdcawley 2003-01-09T16:03:23+00:00 journal Glark! http://use.perl.org/~pdcawley/journal/9613?from=rss <p>Pixie, the Object persistence system I've been working on for the past few months just got picked for the <a href="http://www.perladvent.org/2002/24th/">Perl Advent Calendar</a>. Which means I should really pester James, who is Pixie's CPAN owner into releasing the latest code which fixes some DBI locking issues and finally adds Garbage Collection.</p><p>I note too that one of the classes that Mark uses as an example of a class that will Just Work with Pixie is 'URI', which doesn't quite work out of the box -- it uses a blessed scalar ref as its representation, which Pixie assumes is unstorable as it stands -- blessed scalars are the commonest placeholder for objects that store their state elsewhere via XS so Pixie assumes they're unstorable. In the case of URI, which <em>doesn't</em> store any extra data anywhere, the fix is simple, just do <code>sub URI::px_is_storable { 1 }</code> somewhere and your problem is solved. I wonder if there's a case for keeping a list of 'known good' classes like URI so people don't have to jump through even that small hoop...</p> pdcawley 2002-12-24T06:16:14+00:00 journal That was fun... http://use.perl.org/~pdcawley/journal/9435?from=rss <p>I'm reasonably confident that I have mail working on the TiBook now. But for a while there, I didn't. In fact, for a while there I had a mailing loop that was causing bounce messages. Luckily, I didn't actually lose the messages, so the upcoming summary should still be reasonably complete, but I'm worried that so many bounces may have got me auto unsubbed from some mailing lists...</p><p>Ho hum.</p><p>Anyway, if you've tried to send me mail and got a bounce, you probably won't need to resend, but it's probably a good idea to don belt and braces and resend it.</p><p>Sorry for any inconvenience caused.</p> pdcawley 2002-12-13T11:19:44+00:00 journal I switched http://use.perl.org/~pdcawley/journal/9403?from=rss <p>And it's lovely. I bought a 500MHz TiBook from a friend for a stupidly small amount of money and it's just lovely.</p><p>Now to make the unix environment a bit more habitable. Does anyone know if I'll suffer by just dropping perl 5.8 in as<nobr> <wbr></nobr>/usr/bin/perl?</p> pdcawley 2002-12-12T10:59:31+00:00 journal One more cult member... http://use.perl.org/~pdcawley/journal/9279?from=rss <p>I am about to become the proud owner of a 500MHz TiBook. A friend is upgrading and offered me his old one at a knock down price.</p><p>Shiny OS X goodness here I come.</p> pdcawley 2002-12-04T22:30:46+00:00 journal Coding guidelines http://use.perl.org/~pdcawley/journal/9100?from=rss <p>I've been looking at long lists of coding guidelines in other places, and it got me to thinking about my own rules of thumb for coding. I think of them as a list of short thoughts to get me in the right frame of mind to code.</p><dl><dt> <b>You Never Code Alone</b> </dt><dd>Always remember, even when you're the only person sat at the keyboard, that you are working as part of a team with those who will be maintaining the code. Treat them with respect and make their life easy. That means: don't assume they're fools and don't assume they don't know the programming language. Assume instead that they have roughly the same level of skill as you and hopefully a little more -- after all, the future maintainance programmer will probably <em>be</em> you. However, <em>do</em> assume that they don't have the entire state of the project in their heads like you do right now.</dd><dt> <b>Don't Repeat Yourself</b> </dt><dt> <b>Naming is Really Important</b> </dt><dd>Spending ten minutes now to come up with the right name for something will pay for itself in the future.</dd><dt> <b>Work on one level at a time</b> </dt><dd>In a particular method, concentrate on making the flow of the method as clear as possible. Push details into helper methods, don't worry if those methods are really short, worry instead that you're about three levels of braces deep already. Pushing something into a helper method gives you an opportunity to come up with a really good name, and that means you won't have to use a comment.</dd><dt> <b>Comment only when absolutely necessary</b> </dt><dd>If you find yourself seasoning a method with comments then stop and think for a minute. Try and find a way of expressing your intent more clearly in code. Save comments for answering 'why' questions; if your code can't answer the 'what' questions by itself then it probably needs more work.</dd><dt> <b>Write the tests!</b> </dt><dd>If you don't have a test for it, how do you know you're doing it right? This is specially important when you come to change how something is done. But don't forget that sometimes the tests are wrong.</dd><dt> <b>Everything else being equal, return <code>$self</code> </b> </dt><dd>And fail with an exception. I know, it looks like a makeweight. But every time I've ignored this guideline I've found myself regretting it later.</dd><dt> <b>Fix it now!</b> </dt><dd>If you come up with a better way of doing something that means changing a pile of other classes, then change the pile of other classes. Don't live with broken windows or you will regret it later. Don't leave long blocks of commented out code and other cruft lying around -- you have revision control for a reason</dd><dt> <b>Decide later</b> </dt><dd>Unless you absolutely have to decide now. But don't be afraid to change your mind</dd><dt> <b>Solve today's problem</b> </dt><dd>Don't worry about tomorrow. So what if, in three weeks time you have to redo some of what you did today, it's not like you're building a house.</dd><dt> <b>Use a revision control system</b> </dt><dd>CVS, Subversion, RCS, perforce, SCCS I don't care what you choose, but choose. Revision control is <em>not</em> an option.</dd><dt> <b>Use your judgement</b> </dt><dd>Consistency is good. Guidelines are good. But one of the measures of true skill is knowing when to ignore a guideline or dispense with consistency</dd></dl> pdcawley 2002-11-22T22:38:09+00:00 journal Phew... http://use.perl.org/~pdcawley/journal/9086?from=rss <p>Okay, I finished refactoring my transaction objects and I've got all the tests back running again (moving to using a state object actually made things a little stricter; it turns out some of the tests were playing fast and loose so I had to tweak one or two of them slightly (and fix a few bad assumptions in the state code of course)).</p><p>You really notice how useful tests are when you attempt something like this though. Every time I moved a method over to the state, I ran the tests and made sure everything was passing (modulo a couple of test scripts that I knew I'd have to leave failing until I'd completed the move).</p><p>Any failing tests pointed me back to areas where I'd misunderstood what was going on, and the whole thing gave me confidence that the cleaned up code was still doing the same thing as the old ugly code. I've inherited rats' nests like this before, and without tests it's a <em>nightmare</em>, you end up spending ages trying to capture the old behaviour with tests before you can go on to actually cleaning up the code.</p><p>Next step, unifying this state object with the 'dispatch state' that a transaction hangs onto as a sort of 'bookmark' into its processing pipeline.</p> pdcawley 2002-11-22T14:06:16+00:00 journal Real life and patterns http://use.perl.org/~pdcawley/journal/9055?from=rss <p>So, I have this funky transaction object, with all sorts of state dependent behaviour. There's loads of methods with a very similar nest of conditional logic at the top.</p><p>So, being a good boy, I add a 'state' attribute to my class and start moving things over to my State classes. I move the first couple of methods over, run the tests and a huge pile of 'em fail. Big style.</p><p>So, I look through the code and find a repeated:</p><blockquote><div><p> <tt>croak "some message" unless $self-&gt;{foo}{bar};</tt></p></div> </blockquote><p>and the tests are failing 'cos they're dying with that self same message. So, we 'Extract Method' on that <code>$self-&gt;{foo}{bar}</code> into a <code>is_initialized</code> method, rewrite <code>is_initialized</code> to do <code>$self-&gt;state-&gt;is_initialized</code>, and Robert is our parent's sibling.</p><p>Of course, this refactoring would have been <em>so</em> much easier if we already had an C<code>is_initialized</code> method. Just goes to show that, no matter how small the unit of repetition is, the <a href="http://c2.com/cgi/wiki?TheDryPrinciple">DRY Principle</a> applies. It also goes some way to showing that there's something in Design Patterns, but that's an argument for another day...</p> pdcawley 2002-11-21T12:10:50+00:00 journal Oh yes. http://use.perl.org/~pdcawley/journal/8641?from=rss <p>The new camera has arrived and is, as I suspected, lovely. Now I need to practice with it 'til I'm taking decent photos again; the things have done so far have been terrible...</p><p>Speaking of photos, I just found my negs from YAPC::EU::19100, the London one. I'll see about getting the good ones scanned and up on the web some time this week.</p> pdcawley 2002-10-28T15:31:00+00:00 journal Oh dear... http://use.perl.org/~pdcawley/journal/8637?from=rss <p><a href="http://www.moonthewhitehouse.com/">Snigger!</a></p> pdcawley 2002-10-28T14:01:19+00:00 journal Quake Rocks Britain http://use.perl.org/~pdcawley/journal/7920?from=rss <p>Was the headline on one of the newspapers as I came into London. I confess that I found myself wondering if iD had made a surprise software release that was proving very popular. But, rather boringly, it turns out there was an earthquake in Birmingham.</p> pdcawley 2002-09-23T11:00:13+00:00 journal Digital Schmigital. (or, why my parents are stars) http://use.perl.org/~pdcawley/journal/7828?from=rss <p>Once upon a time I had a <a href="http://www.wista.co.jp/e_wista/e_show/e_camera/e_camera.htm">Wista Technical Field Camera</a> (contains Engrish), and a very fine piece of kit it was. However, having spent <em>far</em> too long 'between jobs', I had to sell it last year. And <em>boy</em> have I missed it.</p><p>The weird thing is, I never really took that many photos with it, you <em>don't</em> with a large format camera. But I can say that I was proud of every photo I did take with it. There's something about the slowness (and the costs per exposure come to that) of working with large format that makes you consider carefully and visualize all your shots. Plus, when your camera rig weighs as much as mine did, you tend to leave it in the car until you're sure of the shot you want.</p><p>After a year of wishing I still had the camera (I'd kept a 150mm lens, for old times' sake, but pretty much everything else got sold), and thinking that I'd probably have been better off selling my 35mm rig, I mentioned this to my parents. So, on my Birthday last Sunday I got a b'day card with the magic phrase 'IOU 1 camera' in it. I now have an <a href="http://www.ebonycamera.com/cam/main.45S.html"> Ebony 45S</a> on order from <a href="http://www.robertwhite.co.uk/">Robert White</a> and I'm so excited.</p><p>Weirdly, it's also got me thinking about the whole 35mm versus Digital thing. I still think real film is better than digital for 'considered' work, but you relinquish so much control with 35mm. One of the important tools of black and white photography and visualization is the 'Zone System', developed by Ansel Adams. To use the system to its best advantage you (potentially) need to develop each negative differently; with 35mm, unless you make every exposure in the same lighting conditions, you really can't do that. For me, this pretty much pushes 35mm towards being used for 'record' work and informal portraiture, which is where the immediacy of digital really shines through.</p><p>So, time to start saving the pennies for a D100 and the very lovely 17-35/2.8 AFS lens that Nikon do. I think I've just had a passion reignited.</p> pdcawley 2002-09-19T09:54:10+00:00 journal Coo... have we done all that? http://use.perl.org/~pdcawley/journal/7818?from=rss <p><a href="/~james/">James</a> asked me to check out the slides for his Pixie presentation at YAPC, which he'll be giving tomorrow. Pixie is the Object Persistence tool that James, Leon and I have been working on for the past few months. (Although I think I've written the bulk of the code, because I've been the one who actually <em>needs</em> a working Pixie, the design has been very much a collaborative affair, and Pixie wouldn't have come about without James' original, very cunning idea about how to work out what needs storing.)</p><p>Now I've been aware as I've worked on it that it's doing some pretty cool stuff, but it's only when I read the presentation that I realised quite how cool it is already, and it's still got some way to go.</p><p>Right now, Pixie gives you:</p><ul><li>Object persistence for virtually any object with a hash or array based representation. Without schemas</li><li>Object persistence for objects that use Regexp or simple scalar references, and don't hold any other 'out of band' information, but you have to do <code>sub Class::px_is_storable { 1 }</code></li><li>Object persistence for any other kind of class you care to mention, provided those classes make use of Pixie's 'Complicity' features.</li><li>Automatic management of object locks, either exclusive, shared, or readonly, with unlocking handled correctly when an object goes out of scope.</li><li>Custom DESTROY behaviour for <em>all</em> objects managed by Pixie, without any reblessing, lexical hooks or whatever: If your objects already have DESTROY behaviour, that behaviour will be called transparently. I may be releasing a version of the code that does this, probably called 'Ref::Footnotes', but I'm not sure yet.</li><li>A test suite that uses characters from Buffy the Vampire Slayer (A small thing, but it is a product of London.pm members)</li></ul><p>Yes, there are things it can't do: we don't have a query language (but, dammit, we don't want one, and if you do Pixie is subclassable); if your objects do tricks with weakrefs you'll probably have to make use of complicity; the documentation is currently lousy; the datastore isn't garbage collected (yet, that's what I'm working on at the moment, it's coming on nicely thanks) and the build process could use some work.</p><p>All in all, I think Pixie's a pretty impressive bit of software and, what's more, you can get a relatively recent version of it (released on Monday) from CPAN to play with. I commend it to you.</p> pdcawley 2002-09-18T21:56:02+00:00 journal Whee! http://use.perl.org/~pdcawley/journal/7358?from=rss <p>I got some good news last night.</p><p>As you may know, I've been writing Perl 6 summaries, which I've been posting to the mailing lists, and which O'Reilly have been publishing on the the perl.com website. The reason that they haven't been published here on use.perl.org is that ORA will pay for exclusive content.</p><p>My plan was that I'd get them to pay my fee for the summaries directly to The Perl Foundation and I'd get to give the summaries back to the community <em>and</em> make some money to support Larry at the same time.</p><p>However, this proved a little tricky as O'Reilly weren't set up to be able to make the payments directly to TPF, they'd have to pay me and then I'd donate the money. But having the money cross the pond twice, shedding bank fees and commission in both directions just seemed silly.</p><p>So, last night I got word from Gnat that ORA have sorted out what needs to be done and payments for the perl 6 summaries will start flowing to the Perl Foundation. Hurrah!</p><p>And, this morning, I find that Dave Cross has written a 'linkshortener' for me. Life is good.</p> pdcawley 2002-08-28T08:25:33+00:00 journal Mmm... http://use.perl.org/~pdcawley/journal/7327?from=rss <p>I just got back from Towersey Folk Festival where I had a fantastic time catching up with old friends and standing in a converted barn in a pub's grounds singing my head off (with a certain amount of friendly competition for who could find the best harmony line.) Great stuff.</p><p>Oh yes, in the instrument sales tent there was a chap selling simple system wooden flutes, which are just <em>gorgeous</em>. And Gill's just bought me one for an early birthday present. I am chuffed stupid, it's been about 25 years since I had a flute (a metal boehm system job, very different from this thing, which has the same fingering as a penny whistle.) Time to start seriously practicing.</p><p>Oh yes, and I need to get a case made and find some cleaning gear.</p> pdcawley 2002-08-26T19:14:03+00:00 journal My mother in law died this morning http://use.perl.org/~pdcawley/journal/6432?from=rss <p>Pneumonia, and other complications arising from lung cancer.</p><p>At least it was quick.</p><p>And, last night, I learned that I'm going to be an uncle again.</p><p>I think the word is 'bittersweet'.</p> pdcawley 2002-07-17T21:30:05+00:00 journal A story of the silver age http://use.perl.org/~pdcawley/journal/6290?from=rss <p>I was going through my mail archive looking for something completely unrelated when I came across this. It was written for a bunch of whippersnappers on a mailing list at the back end of last year and I'd pretty much forgotten about it. But when I found it again I found myself thinking "Hey, this isn't bad; it deserves a wider audience." So, here you go.</p><p>Gather 'round oh my children and let Uncle Piers tell you a story of the days when September only lasted around 50 days. The elder days, before, during and just after The Great Renaming. For I was there.</p><p>When I went up to Nottingham I knew nothing about Usenet or the ARPAnet (in fact, in my years at university I never got ARPAnet access, though it was apparently available during my last year there). There was this weird bulletin board system called, if I remember rightly, 'info', which carried mostly local groups, and something called sf-lovers which was a science fiction discussion group and which was far and away the most active.</p><p>Then one day in my second term, a second year told me to 'type rn, it's cool'. So I did. And it was (thanks Larry). I read the Frequently Asked Questions lists on net.announce.newusers with a mounting 'wow! this is really cool!' reaction, and off I went to start reading. I didn't actually send my first post to usenet. The 'hundreds, if not thousands of dollars' warning successfully put me off.</p><p>Looking back, the only real difference between Usenet then and Usenet now was that there was no commercial spam and the volume was <em>way</em> lower. There were still idiots who'd crosspost to 101 newsgroups, but that was generally ok, so long as they didn't multipost. There were still flaming lusers and splendidly stupid flamewars (generally about Robert Heinlein, at least on net.sf-lovers, later rec.arts.sf-lovers). The mythical, luser free age was already looked back on nostalgically by the Old Farts, but I got the strong feeling that it never really existed. We were (and still are) a cliquey bunch and I'm quite sure that we've always had to deal with people we thought of as assholes.</p><p>What has changed since those days? (and, to a lesser extent, since my early days as a demon customer and later as the sysadmin at Frontier). Well, there's been a steady erosion of trust, which has been awful to watch. Back in the day, if a site had access to the 'net you could be reasonably sure that the postmaster at least had a clue, and was probably in a position of some authority over the people who posted from that site. Posting priviledges could be (and sometimes were) removed from abusive users. You could generally rely on people not to abuse the system. Just look at the protocols in use at the time. By<br>todays standards they seem terribly naive, most of the time they worked by relying on everyone to play nice and not to start lying to machines. And, dammit, for a long time that was all that was needed.</p><p>The world changed with Canter and Siegel, and with the Morris Worm. I don't think we realised quite how much C&amp;S's spam changed the world at the time, but looking back, here were people who genuinely didn't care how much they were costing the 'net and who had consciously broken the rules (and in those days they were <em>real</em> rules) about commercial traffic. Trouble is, they could, and probably did, point at all the<nobr> <wbr></nobr>.com companies for whom the rules had been quietly bent in order to allow them onto ARPAnet and Usenet. But C&amp;S really drove home the point that these rules were just a gentlemen's agreement and totally unenforceable. The RTM worm did something similar, but it pointed out that we weren't in a playground any more. There were Bad Men out there (or in RTM's case, possibly, Naive Men) who didn't care if they broke things.</p><p>By the time that the ISPs started going, the world had changed again. The people who gained access via Delphi, Genie, AOL and others were no longer being granted access by some benevolent sysadmin. They were paying for it directly and they were the masters now. They had their own, provider culture and they expected Usenet to fit how they expected the world to work. Look at early posts from these people, and the reaction to them, and you'll see massive communications breakdowns between two very different world views. There was always going to be trouble.</p><p>But, on usenet at least, all that really happened was that the volume of traffic exploded yet again, so we got a whole lot more kooks and a whole lot more spammers. And a few of us went off and started the network that shall not be named, which is still going strong, and we also attempted to start usenet2, which failed dismally.</p><p>But I still lament the death of trust. It pains me that there are contemptible little shits out there who are prepared to run dDOS attacks, or who are happy to break into dabox simply because it's there. I hate the fact that I've had to become paranoid. I hate having to run spam filters and I really hate that spam still gets through. I hate the fact that my cix email address gets nothing but spam eight years after it was last used to post something to Usenet, that the GOOD NEWS email virus actually exists now albeit under a different name and I despise Microsoft for unapologetically allowing it to happen. I hate the fact that, if I want to reply to someone on usenet by mail now, the odds are good that if I just hit 'r' and send the message then that message will bounce because of address munging.</p><p>All that (and a good deal more if I really start ranting) said, the 'net is still a fantastically useful and, for me at least, life enhancing resource. Tools and places like google, imdb, amazon and its brethren, the kgs go server, okbridge, PernMUSH, London.pm, The scary devil monastery, rhizomatic.net, use.perl.org and all those other places where cool people hang out have enriched my life. A couple of years ago Gill and I went to the 'States for a couple of weeks and had a fantastic time staying with people that I'd only met on the net before. They were, without exception, great people who made our holiday so much more enjoyable. Without the 'net, we'd probably still have had a fine holiday, but I doubt we'd've taken the trouble to visit Seattle, which was fantastic, or to then drive from Seattle to LA (which was just stunning, I love the Oregon coast, and coming into San Francisco over the Golden Gate Bridge on a gorgeous, clear evening as the sun was setting is definitely something I'm not going to be forgetting in a hurry).</p><p>These are resources that should be shared and that everyone should have the opportunity to use. The loss of trust is, I believe a price worth paying, but you can make your own decisions.</p> pdcawley 2002-07-11T20:23:11+00:00 journal Thoughts on music distribution http://use.perl.org/~pdcawley/journal/6263?from=rss <p>So, what do we know?</p><ol><li>Heavy users of music sharing software buy substantially more records than average.</li><li>The Recording Industry is doing everything in its power to shut down music sharing systems.</li><li>The 'theft' of music via the likes of Napster is being used as excuse to try and enforce nasty crypto based techniques for 'protecting' IP rights.</li></ol><p>Why? The evidence would appear to imply that free access to music actually helps the sales of that music, so surely this is something that the recording industry should be encouraging (or at least, deliberately protesting ineffectually about) so, why aren't they?</p><p>Because the music sharers aren't the people they're worried about. Nor are the DivX sharers.</p><p>Right now, the record companies are the gateway that artists have to pass through to reach a larger public. They managed to enforce their (collective) monopoly because, until recently, distribution of the physical media has been the hard part. Except now, it isn't.</p><p>Tools like Napster had the potential for artists to reach a public without giving up their freedom.</p><p>Here's a case in point. I'm in the process of getting the master tapes of a tape my wife and her friend's album transferred to CD. The tape is a capella harmony singing, of mostly traditional material; the potential audience is small. But, had AudioGalaxy still been up, it would have been the work of very few moments to add tags to the MP3s providing information, not just about the songs, but pointers to where to buy a 'real' CD. Okay, we wouldn't see many sales, but any sale that we did see would be one more sale than would otherwise have been made. And the music would be out there, where it can be heard.</p><p>As the P2P networks get closed down, this sort of distribution becomes harder. Sure, artists can always publish material on their website, but that rules out serendipity. For instance, I was recently looking for recordings of the traditional song <i>Long Black Veil</i> on AudioGalaxy, and found a whole load of versions, by artists I knew and ones I'd never heard of, many of which were fantastic. I also know I'm unlikely to be buying any Dave Matthews Band albums in the future.</p><p>And, once the 'rights managed' systems come online, I don't doubt there'll be pressure to sell hardware that can <em>only</em> play managed content. And where does that leave the artist without a recording contract?</p><p>I honestly don't think I'm being paranoid. I <em>don't</em> thing the record industry is actively trying to screw us. It's trying to protect its revenue stream into the future by controlling access to the market. And that's so wrong it makes my teeth hurt.</p> pdcawley 2002-07-10T19:59:29+00:00 journal Test::Class http://use.perl.org/~pdcawley/journal/6189?from=rss <p>So, you may or may not know that I've been working on and off on <a href="http://search.cpan.org/search?dist=Test-Unit">PerlUnit</a> (aka Test::Unit::TestCase), a Perl port of Kent Beck's xUnit.</p><p>Now, as these things go, PerlUnit is pretty good, it's a fairly straight port of jUnit, which is a java version of the Smalltalk original, sUnit.</p><p>The problem is that it's not really very perlish. You can run PerlUnit tests in such a way that Test::Harness can use the results, but it can be awkward.</p><p>Then, along comes <a href="http://search.cpan.org/search?dist=Test-Class">Test::Class</a> and it's lovely. Adrian Howard has done a fantastic job of taking the basic ideas behind xUnit and the simple interface of Test::More/Simple that we're used to, and producing a really useful synthesis of the two.</p><p>He doesn't try and do as much as PerlUnit, and there are a few surprises if you're used to the xUnit approach where a failing assertion (which is about the granularity of C in Test::More) bails out of the current test method. PerlUnit counts test methods, Test::Class counts (and requires you to, but makes it easy) the tests done within methods. The list continues.</p><p>And then, top cap it all, Test::Class is <em>tiny</em> PerlUnit is, frankly, enormous. I'm sure there are times when I'll find myself hankering for some deep feature of PerlUnit, but for now, I'm switching to Test::Class.</p><p>Oh yes, and Test::Class plays well with Test::MockObject, which is another top notch testing tool.</p> pdcawley 2002-07-05T11:47:58+00:00 journal ActiveState Awards or, "Why I didn't vote for Damian" http://use.perl.org/~pdcawley/journal/6143?from=rss <p>As <a href="/~Matts/journal">Matts</a> has already noted, the nominations for the ActiveState Award are up. The nominees are Schwern, Matt Sergeant, Michael Peppler, Damian Conway and Bill Luebkert.</p><p>Now, grumbles about the voting system aside (there's no way that I, as a Perl programmer, am competent to vote in the other polls, I haven't the <em>faintest</em> idea who any of those people are for heavens' sake.</p><p>Now, as a long time supporter of Mr Conway, you'd think I would have immediately stuck my cross next to his name and made a vote. Well... no; I voted for Schwern.</p><p>Why? Because as I understood the Award, it is supposed to be for the 'unsung heroes'. And Damian, for all he's a great guy, superb speaker top notch programmer and trainer, isn't exactly unsung. Hell, he has an Award named after him.</p><p>Schwern however, is pretty much unsung outside the Perl community (and in some cases within that community), the work he's done hasn't exactly been glamourous, but the testing effort that he's spearheaded is vitally important. Because of Schwern's efforts, the perl core is better tested than it's ever been, and we have better and more immediately accessible tools for writing tests in our own modules. And this is very good indeed.</p><p>So, vote Schwern. Vote early. Vote often. Nag Activestate to allow voting in a subset of all the categories.</p> pdcawley 2002-07-03T08:25:02+00:00 journal What did I do yesterday http://use.perl.org/~pdcawley/journal/5924?from=rss <p>Well...</p><p>I wrote a Perl 6 Summary and posted it to the perl6-announce, perl6-language and perl6-internals mailing lists. Hopefully it'll end up on perl.com at some point. I intend to keep doing it for a while.</p><p>And I've been thinking about funding. I'm doing these summaries because I think they're important (I missed 'em when they were gone), I don't want any money for doing it, but it'd be <em>really</em> cool if my doing this work could help fund Larry, Dan &amp; Damian (and whoever gets any grant next year...). Which leads me to wonder if there could be some way of setting up 'accounts' with YAS for this sort of funding. Say you think the Perl 6 summary is worth ten of your hard earned bucks, you could make a donation to YAS saying, in essence "That's for the Perl 6 summaries", and the donations list would reflect that.</p><p>You could do similar things for modules. Say you really, really like Andy Wardley's Template Toolkit. Now, if there was a Template Toolkit YAS account, you could donate money under that label.</p><p>What do you think?</p><p>What else did I do? I got Apache::MP3 up under apache2 and modperl2. The required changes are actually quite small, but they are incompatible with mod_perl 1.xx. Which is annoying. I'm going to see about refactoring so we can either have Apache2::MP3 and Apache::MP3, or just a plain Apache::MP3 that works with both versions of modperl. (Essentially, if you're interested, the changes are <code>use Apache::Const</code> instead of Apache::Constants, and you need to do <code>sub handler : method {...}</code> to have the handler used in an OO fashion.)</p><p>Oh yes, I went to the dentist for the third time in as many weeks (or the third time in about 6 years...) and had the first stage of a root canal done. Ouchie. At least it's on the National Health, but it definitely wasn't fun. The tooth is still aching...</p> pdcawley 2002-06-25T08:23:55+00:00 journal A puzzle http://use.perl.org/~pdcawley/journal/5429?from=rss <p>So, what do you think the following code does?</p><blockquote><div><p> <tt>package Bar;<br>use overload '""' =&gt; sub { "Bar" };<br> &nbsp; <br>package main;<br> &nbsp; <br>$a = $b = {};<br>bless $b, 'Bar';<br>print $a, "\n";<br>print $b, "\n";</tt></p></div> </blockquote><p>It's not</p><blockquote><div><p> <tt>Bar<br>Bar</tt></p></div> </blockquote><p>which is what I would expect.</p><p>Instead we get:</p><blockquote><div><p> <tt>Bar=HASH(...)<br>Bar</tt></p></div> </blockquote><p>Which isn't exactly great. This is a problem on (at least) perl 5.8.0rc1, 5.6.1 and 5.6.0.</p><p>I think this is the same problem as I tripped over when I was working on reblessing objects in Pixie from a class which <em>did</em> have overloads to one which didn't.</p> pdcawley 2002-06-05T12:46:41+00:00 journal Thinking about Object persistence. Again. http://use.perl.org/~pdcawley/journal/5336?from=rss <p>So, you may or may not know that I'm working on (yet another) Object persistence tool (with <a href="/~james/">james</a> and <a href="/~acme/">acme</a> of this parish.</p><p>"An object persistence tool?" You ask, "There's hundreds of 'em, aren't you just reinventing the wheel?"</p><p>Well, yes and no. We've looked at a whole heap of tools that are available and none of them fit the bill for what we want. Our design goals have been, in no particular order (I've numbered the list so I can refer back):</p><ol><li>Allow the user to throw any kind of object at the database, whether built on a hash, an array, a pseudo hash or any of the other things that one can build objects with.</li><li>Don't require any support from the user classes. But provide hooks that, if the user <em>wants</em> to 'help' the persistence framework she can.</li><li>Be neutral about the physical storage.</li><li>Don't <em>require</em> a schema before anything can be stored.</li><li>Keep it Simple. You should be able to store an object and get a cookie back and then use that cookie later to retrive the object. And that is all. Complex indexing and querying should be something that can be built <em>on</em> not something that is built <em>in</em></li><li>Don't pull in the world. If I fetch an object that's at the top of a tree I don't want the entire tree fetching immediately. Unless I explicitly ask for it of course.</li><li>Try not to 'save the world'. Don't go saving the same object 100 times. Try and avoid saving objects that haven't changed since they were last saved.</li></ol><p>And do you know, it's starting to come together. We're using James' trick with <b>Data::Dumper</b> and <code>bless</code> as a way of walking object trees (which hurts your head the first few times you look at it, but which gets rid of a whole pile of treewalking code). Once you get your head wrapped 'round how it works, it all starts to seem remarkably simple...</p><p>So, what do we have working. Part 1 is really, really hard in the general case. For now we can reliably store most 'pure perl' objects that aren't based on CODE refs. Storage is more efficient (ie: We can do deferred fetching tricks) if the classes support an <code>_oid</code> method. Things fall apart (badly) in the case where we have XS classes that use the blessed reference as a key to some perl inaccessible data structure out in C space. The general rule of thumb is that, if an object has state that <b>Data::Dumper</b> can't see, then neither can we. It'd be <em>really</em> cool if Data::Dumper were a little more 'hooky', and checked for, say, '_Dumper' method on all classes and could hand off the responsibilitly for serializing to perl code to those objects that wanted it...</p><p>Point 2 is pretty much covered (modulo what was discussed in point 1). Objects can help by providing an <code>_oid</code> method, but we can generally cope if they don't.</p><p>Point 3, yup, we do that, we have <b>Pixie::Store::*</b> objects for DBI, BerkeleyDB and Memory (that last is a hangover from early algorithm testing...). The DBI store uses the very lovely <b>DBIx::AnyDBD</b> to cope with database inconsistencies. (If you've not looked at <b>DBIx::AnyDBD</b> and you do anything with databases then I strongly recommend you take a look. <a href="/~Matts/">Matt Sergeant</a> is a genius.) Currently the only database we have a 'specific' module for is MySQL, but that's just to get round the lack of real transactions by using their atomic <code>REPLACE</code>.</p><p>Point 4. Yup, we do that. We not only don't require a schema, we wouldn't know what to do with one if we had it.</p><p>Point 5. Yup. It's simple all right.</p><p>Point 6. Yup. If an object contains other objects that are stored seperately (objects that have oids) then we don't pull them in immediately, but instead provide a proxy.</p><p>Point 7. Sort of. A lot of this falls out as a result of deferred loading. When we store an object we store all the 'real' objects that are 'reachable' from it, but we stop when we reach a proxy object. We could probably be more efficient, but I've not had a hard think about pathological cases yet.</p><p>We've now reached the point where I'm thinking of deploying it for an internal application. There's still issues though. Here's a few that are making me think at the moment.</p><ol><li>Garbage collection. I'm not about to go doing bad things involving reference counting in this database, that would be bad. But that means I need to think about a mark &amp; sweep approach to deletion, and that, in turn means maintaining a 'root set' of objects. Ah well, it'll probably fall out as 'just another index' once we've added indices.</li><li>Indexes. We want to be able to do things like 'get me all the Widget objects' without having to load every single object in the database and do an 'isa' query on it. This means we need some way of adding indexes to the store. Ideally I'd like to be able to either have an index from the beginning, maintained by insertions and deletions or to add one late in the game and have it build itself.</li><li>Querying. I'm not a big fan of trying to bend a sql like query language to fit an OO world; I'm more inclined to go with a system of filtering of sets/indices. If you want a full on query language it should be possible to build it on top.</li><li>Uniqueness. Not sure it's the right word. I'm talking about the idea that, if you have an object with an oid of, say 'Homer', then there should be one (and only one) object with that oid in memory (and ideally it should be unique across all processes too, but that's just scary.)</li><li>Granularity(?). Sometimes you want an object that writes its every change back to the database. We don't do this. But it should be possible to implement something on top of what we have.</li><li>Atomicity. We're a hostage to our store for this. It should be possible to insert a complex object into the database (one that points to a bunch of other, sub objects) on an all or nothing basis. If one sub insertion fails then all the others should be rolled back. This should work in the BerkeleyDB store and on DBI backed stores that support transactions, but it'd be really cool if we could support it on non transactional stores too...</li></ol><p>"So, where can I find this paragon of perl persistency? And what's it called?"</p><p>Well, it's called 'Pixie' (ask Acme), and right now you can't have it. Some of the current tests are adapted from Tangram and are only distributable under the GPL, and we want Pixie to be destributed under the same terms as Perl. So, we need to either get permission to distribute them under a dual license, or get rid of them entirely.</p><p>I'll be off to ask for permission as soon as I've hit 'save' on this form, so we should know one way or the other soon.</p> pdcawley 2002-05-31T09:35:38+00:00 journal And... relax! http://use.perl.org/~pdcawley/journal/5224?from=rss <p>Well, we've just handed my 18 month old nephew, Albert back to his parents after looking after him for, ooh... a day and a half.</p><p>And we're <em>knackered</em>. He was, of course, utterly wonderful (though the time when he flung himself into my arms from halfway up the stairs was a moment I could have done without) but very, very tiring. How do the parents among you do it?</p> pdcawley 2002-05-26T16:35:34+00:00 journal It's the little things that bring happiness http://use.perl.org/~pdcawley/journal/5119?from=rss <p>I just found out that my project manager's surname means `Fool'. Now, he's a decent bloke and everything, and good at the job.</p><p>But it still brings a big smile to my face knowing that my project manager is a fool.</p> pdcawley 2002-05-21T15:46:54+00:00 journal