godoy's Friends' Journals
http://use.perl.org/~godoy/journal/friends/
godoy's Friends' use Perl Journalsen-ususe 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:23:46+00:00pudgepudge@perl.orgTechnologyhourly11970-01-01T00:00+00:00godoy's Friends' Journalshttp://use.perl.org/images/topics/useperl.gif
http://use.perl.org/~godoy/journal/friends/
Bob Jacobsen interview on FLOSS Weekly
http://use.perl.org/~merlyn/journal/40324?from=rss
Last week, I interviewed Bob Jacobsen for FLOSS Weekly. Bob used Perl's Artistic 1.0 license on some Java code to manage model trains. The code was later patented by an Oregon-based company(!) and then Bob got sued(!!) for Bob distributing the other company's patented code(!!!). The good part of the story is that this is the first test at the US Federal Appeals Court level for an open source license to be enforceable even if no money exchanges hands, and... we won!
<p>
Bob spent a lot of time and money on the case though. Listen to <a href="http://twit.tv/floss117">the podcast</a> and contribute to <a href="http://jmri.sourceforge.net/donations.shtml">his legal defense</a> if you care about open source.</p>merlyn2010-04-23T03:55:11+00:00journalah, dreams...
http://use.perl.org/~Matts/journal/40130?from=rss
<p>I just woke from a dream where it was rjbs' birthday and we got him an onion cake. Only the person who made the cake misunderstood, and instead of a cake shaped like an onion he cooked it WITH onions in it.</p><p>Bizarro.</p>Matts2010-01-26T10:31:17+00:00journalTime::Piece test failures on Win32
http://use.perl.org/~Matts/journal/40129?from=rss
<p>Can someone with Time::Piece test failures on Win32 please contact me offlist? I have a proposed patch I'd like to test, but no Win32 perl to test it on.</p>Matts2010-01-25T23:23:53+00:00journalWarning compiling perl stuff on Snow Leopard
http://use.perl.org/~Matts/journal/40075?from=rss
<p>I've searched but can't find any reference to this...</p><p>Compiling IO::KQueue on Snow Leopard I get the following warning:</p><blockquote><div><p> <tt>KQueue.xs: In function 'XS_IO__KQueue_kevent':<br>KQueue.xs:71: warning: format not a string literal and no format arguments</tt></p></div> </blockquote><p>Yet that line is just:</p><blockquote><div><p> <tt> Newxz(ke, max_events, struct kevent);</tt></p></div> </blockquote><p>Which seems to me pretty standard perl, and no format strings involved (though Newxz expands quite a few macros).</p>Matts2010-01-04T22:13:57+00:00journalI'm twittering my Perl stuff at http://twitter.com/briandfoy
http://use.perl.org/~brian_d_foy/journal/40068?from=rss
<p>I'll tweet at (http://twitter.com/briandfoy_perl) when I have something to say in 140 characters. I'll almost always use "Perl" when I post.</p>brian_d_foy2010-01-02T13:06:32+00:00journalEffective Perl Programming master class at Frozen Perl
http://use.perl.org/~brian_d_foy/journal/40065?from=rss
At <a href="http://www.frozen-perl.org/mpw2010/briandfoy.html">Frozen Perl 2010</a> in Minneapolis, I'm teaching a new master class based on my latest book, <a href="http://www.amazon.com/Effective-Perl-Programming-Software-Development/dp/0321496949">Effective Perl Programming, 2nd Edition</a>. Perl has changed quite a bit since Joseph Hall wrote the
first edition over 10 years ago. Josh McAdams and I have added a lot of new information as well as updated the existing material.
In the one-day class for intermediate Perl programmers, I'll cover
selected topics from the book, including:
<ul>
<li>Working with Unicode in Perl</li>
<li>Tricks with filehandles</li>
<li>New regex features in Perl 5.10 and later</li>
<li>Playing with pack()</li>
<li>Using closures to make things simpler</li>
<li>and other topics as time allows</li>
</ul><p>
Although the book hasn't been published yet, it is available for
pre-order, and attendees to the class can get a sneak peek at the
working manuscript as well as a soft copy of the course slides.</p>brian_d_foy2010-01-01T13:32:50+00:00journalWhat's your coolest Perl one-liner?
http://use.perl.org/~brian_d_foy/journal/40028?from=rss
<p>Josh and I are finishing up <a href="http://www.amazon.com/Effective-Perl-Programming-Software-Development/dp/0321496949/">Effective Perl Programming, 2nd Edition</a>, and the last part to finish off is the item on Perl one-liners.</p><p>Besides going through writing a one liner, we want to list a bunch of them too. Want to get your name in the book? Give us some one-liners that you wrote yourself and a couple of sentences about what it does. Make sure you tell us how you'd like your name to appear in the book, too.<nobr> <wbr></nobr>:)</p>brian_d_foy2009-12-17T06:19:18+00:00journalI'm in Dublin on Sunday
http://use.perl.org/~brian_d_foy/journal/39789?from=rss
<p>I kept meaning to post this, and I can't believe it's already this late in October.</p><p>Jonas Nielsen and I are going to be in Dublin, Ireland on Sunday because we're both running the marathon on Monday. If any local Perl Mongers want to get together for a drink on Sunday early evening, let me know. I'm staying about a mile from the marathon start and otherwise have no idea of the geography.</p><p>It might be my only time to see Jonas. Once he leaves the start line, I won't see him for hours.<nobr> <wbr></nobr>:)</p>brian_d_foy2009-10-22T20:13:37+00:00journalI'm a Perl::Critic committer.
http://use.perl.org/~brian_d_foy/journal/39787?from=rss
<p>Elliot forced me to accept a commit bit to the Perl Critic repo.</p><p>My first policy will be *::YouArentAllowedToProgramAnymore, which deletes your source if it finds that you fail any policy, you have any use of 'no critic', you run Perl::Critic more than once on the same file, or if it's Friday afternoon. If you have your stuff in source control, you should be safe. That's the fence you have to jump over to get back in, though.</p><p>Elliot already shot down my policy suggestions for *::NotEnoughVowels, *::PassiveVoiceInString, *::MisconjugatedVerb, *::StupidVariableName, *::UsesWindows, *:;DependsOnModules, *::YouEditedThisInEmacs, *::Magic8Ball, *::YourNameIsPudge, *::YourModuleWebsiteIsUgly, and *::YourPerlIsSoLastMonth.</p>brian_d_foy2009-10-22T14:07:02+00:00journalI need some Unicode examples for Effective Perl Programming
http://use.perl.org/~brian_d_foy/journal/39675?from=rss
<p>Josh McAdams and I are updating Effective Perl Programming, and I'm working on a bunch of items dealing with Unicode.</p><p>I need some really nice non-english and especially non-romance language examples for some of the features we want to discuss. I'd love to be able to include sample strings in Chinese, Japanese, Russian, Portugeuse, Arabic, and all sorts of other languages I have no clue about. Most of what I need are the sample phrases. If you don't have something interesting, maybe you can translate "Perl mongers" for me in an example like:</p><blockquote><div><p> <tt>use utf8;<br>my $phrase = '...'; # fill in your phrase<br>
<br>if( $phrase =~ m/\N{Some charname}/ ) {<br> say 'I matched a<nobr> <wbr></nobr>...';<br> }</tt></p></div> </blockquote><p>I also want to add a couple of examples of other encodings, especially non-Western ones. I have no idea about those encodings, but I don't need anything fancy.</p><p>I'm sure that everything is going to get messed up and translated incorrectly, so I'll be sure to let you see the proofs of your example to ensure the typesetters get it right in the end.<nobr> <wbr></nobr>:)</p>brian_d_foy2009-09-25T07:25:05+00:00journal$9.99 Learning Perl and Mastering Perl e-books from O'Reilly
http://use.perl.org/~brian_d_foy/journal/39524?from=rss
<p>O'Reilly dropped the regular price of e-books for <a href="http://oreilly.com/catalog/9780596520106/">Learning Perl</a> and <a href="http://oreilly.com/catalog/9780596527242/">Mastering Perl</a> to $9.99. I volunteered to be the guinea pig for pricing experiments. I specifically want to see if this makes it easier to get these books when access to the hard-copies is prohibitively expensive. You can get these books in Mobi, PDF, or ePub directly from O'Reilly. I'd like to do more of these sorts of experiments to get the books into as many hands as possible.</p><p>The $9.99 price is the regular price, so all existing discount and coupon codes apply. For instance, you can still use the 35% user group discount to get either book for $6.50.</p><p>These are the updated versions of the books too. All reported errata should be corrected, so they are slightly fresher than the hard copies.</p><p>Remember, the great thing about PDFs is that they don't take up any shelf space. Buy as many as you like!</p>brian_d_foy2009-08-24T20:00:18+00:00journalEarly Komodo Edit review
http://use.perl.org/~Matts/journal/39063?from=rss
<p>Recently I started using Komodo Edit (the free version of Komodo IDE). This is an early review, of having used it for my work for about a week, which isn't really enough to know whether I'll be sticking with it, but it's a good start. I started to get a bit tired of the limitations of TextMate - an editor I like, and paid for, but the v2 which they keep hinting at seems to never be coming, and it has some short-falls which I find very annoying.</p><p>ActiveState actually asked me to do a review of Komodo IDE a while ago and I never got around to it, so I never got a free license key from them. Maybe they'll read this<nobr> <wbr></nobr>;-)</p><p>This review is of using it on my MacBook (non-pro) 2.4Ghz, 4GB Ram.</p><p>The Good<br>========</p><p>Generally it has everything I'm looking for:</p><p>- all documents in tabs<br>- mostly the right keystrokes for everything (i.e. it's not VI or Emacs, though I believe it has vi emulation for the die-hards) - I only had to fix Cmd-[ and Cmd-] for indent/deindent.<br>- open over scp/sftp.<br>- syntax highlighting seems to just work (haven't found any flaws yet, though Perl can be tricky that way!).<br>- shows line numbers, folds, etc in a nice way<br>- autoindent mostly works well<br>- macros in Javascript/Python make it VERY flexible<br>- "show current file changes" (before you save) is an AWESOME feature, and loads them into the proper "diff" window<br>- macros even allow you to access that diff window, so writing some macros to access our version control system (AccuRev - don't ask!) was relatively straightforward for a non-Javascript coder like myself<br>- macro output looks like it'll be easy enough to write a Prove/Test.pm runner</p><p>The Missing<br>===========</p><p>There are always things missing in editors, usually things I've experienced elsewhere that I'd love to see replicated:</p><p>- I *love* textmate's ability to re-indent code when I paste it in, at the correct current level.<br>- I wish open over sftp would allow me to open a whole directory (i.e. treat it like a temporary project)<br>- I wish I could open a directory instead of have to create a project.<br>- I wish tabs would double over instead of flow off the side (as an option) as I tend to keep a lot of files open<br>- I wish the project pane would highlight the current file/tab instead of the last file I double clicked on<br>- Documentation of the macro stuff is a bit weak, though the forums are good for help on this (I haven't posted, but the search has helped a lot, and most posts seem to get a reply).</p><p>The Buggy/Broken Bits<br>=====================</p><p>- There's sometimes an oddness with macros - sometimes I edit them and the edits don't "take" - restarting fixes this.<br>- Can be a TINY bit slow. I'm on a fast mac, so I suspect this would be much worse on my G4 laptop.<br>- The find options seem a bit odd to me - there's multiple locations for "find" - in the toolbar and in a separate window, be nice if it were unified and accessible with Cmd-F<br>- Open over sftp seemed a bit fragile and has hung on me once</p><p>Overall though, I like it. I'm not really sure what Komodo IDE could add over and above this, I suspect it'll just come with a lot of cool plugins and macros that do clever things...</p><p>I'll maybe post more on this if I keep using it.</p>Matts2009-06-02T00:05:35+00:00journalI'm Off
http://use.perl.org/~davorg/journal/38996?from=rss
<p>For pretty much the same reasons that you've heard from many other people, I've decided to take my Perl blogging elsewhere.</p><p>You'll find me over at <a href="http://perlhacks.com/">Perl Hacks</a>.</p>davorg2009-05-18T20:07:54+00:00journalYAPC::Europe Talk Proposals
http://use.perl.org/~davorg/journal/38903?from=rss
<p>The CFP for this year's <a href="http://yapceurope2009.org/">YAPC::Europe</a> closed yesterday. Usually this means I have a frantic couple of hours rushing around proposing (semi-)random talks. This year I've been a bit more organised and have been proposing talks as they have occured to me. The upside of this is that I have confidence that they will all be interesting talks. The downside is that I've proposed more talks than ever before. I hope the organisers don't select all of them (I'd like to see <i>some</i> of the conference) but I've given them lots of choice<nobr> <wbr></nobr>:-)</p><p>There are a couple of talks based on the conference's theme of "Corporate Perl".</p><ul>
<li> <b>Why Corporates Hate Perl</b> <br>This will be loosely based on my <a href="http://www.oreillynet.com/onlamp/blog/2008/08/why_corporates_hate_perl.html">blog post</a> from lst year - but I've got lots of other things to add based on the feedback I received. This is, at least partly, a sequel to <a href="http://mag-sol.com/talks/yapc/2006/lang/">Programming Languages and Perl</a> and <a href="http://mag-sol.com/talks/yapc/2008/proud/">Proud to Use Perl</a>.</li><li> <b>Why do so many companies re-invent well-known CPAN modules badly and end up writing far too much code?</b> <br>I was going to give this talk at a recent London.pm technical meeting, but was ill and was unable to present it. The title pretty much describes what I'll cover.</li></ul><p>There's a talk following up on something I spoke about last year in Copenhagen.</p><ul>
<li> <b>Perl in RPM-Land (The Return)</b> <br>Last year I talked about <a href="http://mag-sol.com/talks/yapc/2008/rpm/">building RPMs</a> of CPAN modules and suggested that we could do this automatically for a large percentage of modules. This is conference-driven development. If this talk is chosen then I'll have to make a start on the project.</li></ul><p>And there's a talk about a project that I'm currently pretty enthused about.</p><ul>
<li> <b>The Planetarium</b> <br>This is about using Perl to aggregate web feeds. In particular I'm trying to build sites that are useful tools for building local communities. It's not really on-topic for the conference, but I think it's interesting.</li></ul><p>So now it's just a case of seeing which ones the conference organisers choose. Does anyone know when that will be announced?</p><p> <b>Update:</b> They chose <a href="http://yapceurope2009.org/ye2009/talk/1939">Why do so many companies re-invent well-known CPAN modules badly and end up writing far too much code?</a> and <a href="http://yapceurope2009.org/ye2009/talk/2069">The Planetarium</a>.</p><p>I'll see you in Lisbon.</p>davorg2009-05-01T10:58:39+00:00journalbackticks make my Windows testing service hang on ack
http://use.perl.org/~brian_d_foy/journal/38804?from=rss
<p>I've run into an interesting situation in testing CPAN modules on Windows using <a href="http://www.jetbrains.com/teamcity/index.html">TeamCity</a>. Testing from the command line, either cygwin or command, works fine, but when the automated tester has a go, it fails. I traced this back to modules that use system() or backticks. The ack distribution has been the one to demonstrate the problem first. I wonder if anyone else has seen a similar problem.</p><p>I've been working on a custom internal CPAN for a big company, and their CPAN is actually in subversion. When the subversion repo changes, lots of tests kick off, including tests for individual modules as well as integration tests. These tests run on both unix and Windows using the TeamCity build agents. Some of the Windows tests just hang forever, although they run fine on my workstation.</p><p>It appears that the Windows build agents are run as a Windows service, so it's not connected to something that can handle system calls. I don't understand the Windows set-up and architecture enough to say more than that. Once the build agent hits a line of code that wants to shell out somehow, it hangs forever. It only does this in the build agent.</p><p>I was working with ack, which has a t/Util.pm for things that most of the tests use. There is a run_ack_with_stderr() subroutine which uses backticks, and that's where the code hangs. Once it runs t/ack-1.t, everything stops.</p><p>Paul's IPC::System::Simple::capture() works as a backticks replacement and has already solved many problems we've had with Windows. However, my first try in replacing backticks made all sorts of other tests fail even though it could run the commands now. Nothing hung, but there was something I wasn't capturing correctly or putting in the right place, I figure. I eventually had to cut bait since I'm not getting paid to work on third-party modules.</p><p>I'm curious how this works for the Windows CPAN testers. Are you just running the testing script from a command or terminal window? Do you ignore distros that just hang? I didn't see any sort of ack failure that showed the same symptoms.</p><p>And, is there some sort of medal or award that Paul can get for IPC::System::Simple? I wasn't keen on depending on it at first, but now that I've experienced a bit of grief trying to make Windows be unix, I really appreciate IPC::System::Simple taking care of all of that.</p>brian_d_foy2009-04-13T21:54:29+00:00journalPerl on LLVM
http://use.perl.org/~Matts/journal/38786?from=rss
<p>There was recently <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2009/04/msg145425.html">some talk</a> on p5p about getting perl up and running on the <a href="http://llvm.org/">LLVM</a>. This was following the recent excitement from the Python crowd about the <a href="http://arstechnica.com/open-source/news/2009/03/google-launches-project-to-boost-python-performance-by-5x.ars">Unladen Swallow</a> project, and less so, the <a href="http://www.macruby.org/blog/2009/03/28/experimental-branch.html">MacRuby Experimental Branch</a>.</p><p>So following that post I decided to see how easy/hard it was to get to the first stage - getting perl compiled and running with clang, the llvm gcc-like compiler.</p><p>It wasn't too hard (a lot of <a href="http://xkcd.com/303/">compiling</a>). After I got everything running I first ran perlbench, which looked reasonably promising:</p><blockquote><div><p> <tt> gcc llvm<br> --- ----<br>arith/mixed 100 86<br>arith/trig 100 86<br>array/copy 100 101<br>array/foreach 100 92<br>array/index 100 93<br>array/pop 100 96<br>array/shift 100 95<br>array/sort-num 100 89<br>array/sort 100 101<br>call/0arg 100 102<br>call/1arg 100 89<br>call/2arg 100 75<br>call/9arg 100 89<br>call/empty 100 87<br>call/fib 100 90<br>call/method 100 98<br>call/wantarray 100 89<br>hash/copy 100 95<br>hash/each 100 94<br>hash/foreach-sort 100 97<br>hash/foreach 100 91<br>hash/get 100 91<br>hash/set 100 89<br>loop/for-c 100 86<br>loop/for-range-const 100 111<br>loop/for-range 100 116<br>loop/getline 100 96<br>loop/while-my 100 94<br>loop/while 100 96<br>re/const 100 86<br>re/w 100 89<br>startup/fewmod 100 95<br>startup/lotsofsub 100 93<br>startup/noprog 100 101<br>string/base64 100 89<br>string/htmlparser 100 92<br>string/index-const 100 81<br>string/index-var 100 108<br>string/ipol 100 103<br>string/tr 100 86<br>
<br>AVERAGE 100 93</tt></p></div> </blockquote><p>So next step was to try some more real-world code. I took 41k non-spam mails and ran SpamAssassin on them (using the mass-check tool), with no network tests enabled, and a HTML::Parser also compiled with LLVM (and gcc, in the gcc instance).</p><p>Results of the timings:</p><blockquote><div><p> <tt>GCC:<br>
<br>real 40m56.599s<br>user 64m44.586s<br>sys 0m59.644s<br>
<br>LLVM:<br>
<br>real 45m38.831s<br>user 71m14.218s<br>sys 1m20.882s</tt></p></div> </blockquote><p>So rather less promising.</p><p>Still, an interesting start - see the original link for information on where it needs to go from here. I think this might have a lot of mileage if the actual internals were ported to LLVM style code. If someone is interested in picking up this project, and maybe being paid for it, please get in touch.</p>Matts2009-04-09T17:57:03+00:00journalGet 15% off OSCON
http://use.perl.org/~brian_d_foy/journal/38757?from=rss
<p><a href="https://en.oreilly.com/oscon2009/public/register">Register for OSCON</a> with the discount code os09pgm and get 15% off, courtesy of the Perl track committee.</p>brian_d_foy2009-04-04T23:57:35+00:00journalI'm going to Moscow for YAPC::Russia
http://use.perl.org/~brian_d_foy/journal/38750?from=rss
<p>I get to go to <a href="http://2009.yapcrussia.org/mayperl2/">YAPC::Russia</a> because United Airlines has ridiculously cheap airfares to Moscow to celebrate their new direct service from Washington, DC. Even better than that, the frequent flier deals get me to Moscow for the price of a domestic ticket.. The conference is May 16-17, but I'll be there the week before too.</p><p>I just got my <i>Lonely Planet Moscow City Guide</i>, so now I have to start planning my trip.</p>brian_d_foy2009-04-04T02:03:48+00:00journalTask::Kensho RPMs
http://use.perl.org/~davorg/journal/38730?from=rss
<p>One of the first concrete outputs from the <a href="http://www.enlightenedperl.org/">Enlightened Perl Organisation</a> has been <a href="http://search.cpan.org/dist/Task-Kensho/">Task::Kensho</a> - a CPAN module which exists to list a number of other CPAN modules that modern Perl programmers should consider using. if you install Task::Kensho then all of the included modules will automatically be pulled down from CPAN and installed.</p><p>I don't install my modules from CPAN. As I live in the Red Hat world, I like to install RPMs of modules. And I build RPMs for modules that aren't already available in that format (and then I <a href="http://rpm.mag-sol.com/">make them available to everyone</a>).</p><p>So last night I created an RPM for Task::Kensho. This also involved building RPMs for about half of the modules it include which didn't already exist as RPMs in the standard repostories. Those RPMs are now available from <a href="http://rpm.mag-sol.com/">my repository</a> so installing them all could be as simple as <tt>sudo yum install perl-Task-Kensho</tt>. Of course, you can also install individual packages using the appropriate <tt>yum</tt> command.</p><p>Currently the RPMs are only available for Fedora 10. I'll build versions for Centos 5 over the next couple of days.</p>davorg2009-03-31T08:02:06+00:00journal2008 jobs.perl.org report
http://use.perl.org/~brian_d_foy/journal/38615?from=rss
<p>Here are the numbers for the number of job advertisements posted to <a href="http://jobs.perl.org/">jobs.perl.org</a> in 2008, by month.</p><p>I'm not affiliated with jobs.perl.org, and this is only the simplest of analyses. I didn't try to correct for duplicate posts where the same job was re-advertised. I don't attempt to draw any conclusions about the popularity (up or down) of Perl from these numbers. In general, I think that the continual uptrend through 2006 is about more people discovering the service, and the dismal numbers in 2008 mostly reflect the current economic cycle more than anything to do with technology.</p><blockquote><div><p> <tt>-------------------------------------------------------------------------------<nobr>-<wbr></nobr> ----------<br>Year | Total | Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec<br>-------------------------------------------------------------------------<nobr>-<wbr></nobr> ----------------<br>2001 | 280 | 0 2 8 21 40 34 33 29 34 30 35 14<br>2002 | 413 | 34 33 35 16 45 26 37 46 33 42 31 35<br>2003 | 560 | 43 36 56 56 21 39 44 64 53 52 52 44<br>2004 | 949 | 75 58 78 88 74 88 82 87 65 87 85 82<br>2005 | 1429 | 93 110 120 135 135 125 115 113 106 132 144 101<br>2006 | 1857 | 164 138 157 151 166 153 140 176 152 172 179 109<br>2007 | 1966 | 182 156 181 190 177 168 176 165 145 179 148 99<br>2008 | 1451 | 156 140 152 158 156 158 136 110 85 87 71 42<br>---------------------------------------------------------------------------<nobr>-<wbr></nobr> --------------</tt></p></div> </blockquote><p>Also see the threads for the <a href="http://use.perl.org/~brian_d_foy/journal/32142">2006</a> and <a href="http://use.perl.org/articles/08/01/02/0030255.shtml">2007 jobs.perl.org reports</a> for past discussions.. Some other resources include:</p><ul><li> <a href="http://www.presicient.com/langjobs.html">renodino's Dynamic Languages Jobs Barometer</a></li><li> <a href="http://use.perl.org/~Tim+Bunce/journal/35267">Tim Bunce's jobs trends searches from indeed.com</a></li></ul>brian_d_foy2009-03-08T10:10:37+00:00journalMySQL Stupidity
http://use.perl.org/~davorg/journal/38549?from=rss
<p>Been a while since I reported on MySQL's stupidity, but I came across a fine new example yesterday.</p><p>Create a table with a varchar column.</p><blockquote><div><p> <tt>create table foo (foo varchar(10));</tt></p></div> </blockquote><p>Insert a data value which is two numbers separated by a pipe character (don't ask, just accept that this was the data format I found in my table).</p><blockquote><div><p> <tt>insert into foo values ('111|1');</tt></p></div> </blockquote><p>Now let's try to select some data.</p><blockquote><div><p> <tt>mysql> select * from foo where foo = '111|1';<br>+-------+<br>| foo |<br>+-------+<br>| 111|1 |<br>+-------+<br>1 row in set (0.00 sec)</tt></p></div> </blockquote><p>Ok. That makes sense. That's expected behaviour.</p><blockquote><div><p> <tt>mysql> select * from foo where foo = '111';<br>Empty set (0.00 sec)</tt></p></div> </blockquote><p>That also makes sense, of course. The string isn't '111', so it doesn't match.</p><blockquote><div><p> <tt>mysql> select * from foo where foo = 111;<br>+-------+<br>| foo |<br>+-------+<br>| 111|1 |<br>+-------+<br>1 row in set (0.00 sec)</tt></p></div> </blockquote><p>Huh! I mean "What!?!".</p><p>There are at least two fundamentally stupid things going on here.</p><p>Firstly, MySQL is allowing me to match a string column against a number. When a user tries to match a value of one type against a column of another type, the only sensible action is to throw an error. The user is trying to do something completely wrong. Tell them that. Don't try and work something out.</p><p>Secondly, if you insist on trying to convert datatypes in order to force a match, then convert the user's data into the database column's datatype, not the other way round. The database column is a string. Convert the number to a string and try to match that string against the database (that would have returned no data). Instead MySQL is trying to convert the database value into a number to match the user's input. It looks like it's using something like Perl's string to number conversion so the string "111|1" is converted to the number 111 and therefore matches the user's input.</p><p>So you can actually get MySQL to match data which doesn't match at all. I wasted two hours on this yesterday.</p><p>I found this yesterday on a MySQL 4.x server. I've just tried it on a 5.0.67 server and the same bug is still there.</p><p>Oh, and setting the SQL mode to "traditional" doesn't seem to fix it either.</p>davorg2009-02-25T21:56:38+00:00journalIs there a module that lobotomizes subroutines?
http://use.perl.org/~brian_d_foy/journal/38506?from=rss
<p>Is there already a module that will turn a list of subroutines into no-ops? I'm doing this to disable features in production code, not testing, and only because other work-arounds are intractable. It's monkeypatching to give a class a lobotomy.</p><p>I know about Curtis's Sub::Override, so I might just write a wrapper around that for an interface that looks something like:</p><blockquote><div><p> <tt>use Sub::Nerf;<br>
<br>nerf( $return_value, @list_of_subs ); # all subs just return $return_value<br>
<br>unnerf( @list_of_subs ); # back to where we started</tt></p></div> </blockquote>brian_d_foy2009-02-18T20:59:56+00:00journalYak Shaving
http://use.perl.org/~davorg/journal/38505?from=rss
<p>For a few months I've been playing with <a href="http://conky.sourceforge.net/">conky</a> - which is a nice system for writing stuff onto a Linux desktop. I was introduced to it by a series of <a href="http://lifehacker.com/search/conky/">LifeHacker posts</a> last year.</p><p>Just last week, they featured <a href="http://lifehacker.com/5152819/to+dos-weather-and-twitter-on-a-linux-desktop">a really nice set-up</a> which I wanted to go some way to recreated. The post included a link to the programs that were used to create the desktop, so it was easy to work out what was going on.</p><p>Most of the data was pulled from web feeds and converted to flat text. That's a nice approach as once you've got that working, there's no limit to the data you can use.</p><p>I was slightly disappointed, however, to see that the code included in the article had three separate scripts (one for each source used) and that they were all bash scripts which used curl to grab the feeds and load of sed and grep to extract the relevant parts. What this really needed was a generic approach.</p><p>So I reached for the <a href="http://search.cpan.org/dist/Template-Toolkit/">Template Toolkit</a>. And I reached for <a href="http://search.cpan.org/dist/Template-XML/">Template::Plugin::XML::RSS</a>. And then I stopped myself. Not all web feeds are RSS these days (that's why we've largely stopped calling them RSS feeds) so <a href="http://search.cpan.org/dist/XML-RSS/">XML::RSS</a> wouldn't always be the right tool. What I really needed was <a href="http://search.cpan.org/dist/XML-Feed/">XML::Feed</a> - which handles both RSS and Atom and treats them both in the same way.</p><p>But there wasn't a Template::Plugin::XML::Feed. I say "wasn't" rather than "isn't" as <a href="http://search.cpan.org/dist/Template-Plugin-XML-Feed">there is one now</a> - I uploaded it last night.</p><p>I didn't get much time to play with conky. But I've now got all of the tools I need. In particular, I can create simple programs like this to access web feeds.</p><blockquote><div><p> <tt>#!/usr/bin/perl<br> <br>use strict;<br>use warnings;<br> <br>use Template;<br>use URI;<br> <br>my $t = Template->new;<br>my $uri = URI->new('http://search.twitter.com/search.atom?q=@davorg');<br>$t->process(\*DAT<nobr>A<wbr></nobr> , { uri => $uri })<br> or die $t->error;<br> <br>__END__<br>[% USE tweets = XML.Feed(uri);<br> USE autoformat(right => 80);<br> FOREACH tweet IN tweets.entries -%]<br>[% tweet.author %]:<br>[% tweet.title | autoformat -%]<br>[% LAST IF loop.count == 5 -%]<br>[% END -%]</tt></p></div> </blockquote><p>Of course, I need to remove the hard-coded URI and put the template into a separate file. That's tonight's first little project.</p>davorg2009-02-18T13:23:06+00:00journalDakar
http://use.perl.org/~Matts/journal/38317?from=rss
<p>Just want to publicly say congratulations to my brother-in-law Quin for coming <a href="http://www.automobilsport.com/dakar-2009-rally-quin-evans-yorkshire-driver-tollefsen-fourth-overall---39722.html">fourth overall</a> in this year's grueling Dakar rally. An amazing achievement for a non-factory team.</p>Matts2009-01-19T15:10:00+00:00journalYAPC::EU 2009 has a LinkedIn Group
http://use.perl.org/~brian_d_foy/journal/38269?from=rss
<p>José tells me that <a href="http://yapceurope2009.org/">YAPC::EU 2009</a> has a <a href="http://events.linkedin.com/pub/27994">LinkedIn group</a>. You can note that you are attending, presenting, and so on, and get more bling for your profile. You can also see who else is coming.</p>brian_d_foy2009-01-12T21:48:33+00:00journalReleasing Press Releases to the Press
http://use.perl.org/~davorg/journal/38149?from=rss
<p> <a href="http://www.prweb.com/releases/2008/12/prweb1783874.htm">The Perl Foundation Migrates the Perl 5 Development Repository to the Git Version Control System</a> </p><p>That's not news, of course. You all read that <a href="http://use.perl.org/article.pl?sid=08/12/22/0830205">story on the front page of use.perl</a> a couple of days ago.</p><p>What's new (I think) is where you can find the press release. It's on <a href="http://www.prweb.com/">PRWeb</a>. For those who don't know, PRWeb is the best-known press release distribution service. The TPF Git press release will now be arriving in the inbox of hundreds of editors and other interested parties who have subscribed to technology news. And that, of course, increases the chance that the story will be published in the tech press and that people outside of the echo chamber will read it.</p><p>When the Git news broke a couple of days ago, we were discussing it the london.pm IRC channel. <a href="http://use.perl.org/~acme">acme</a> had published the press release in the usual Perl news channels, but someone suggested that as we had a press release, it would be nice to get it out through the standard press release channels.</p><p>It turned out that <a href="http://davehodg.blogspot.com/2008/12/perl-foundation-migrates-perl-5.html">Dave Hodgkinson</a> had a) a PRWeb login, b) half an hour to spare to register the press release and c) the $80 it costs to use the service.</p><p>I have no idea how successful this will be, but it seems to me that if the Perl community has interesting news like this, then it's worth spending the occasional $80 to get that news out on the wires.</p><p>It's got to be worth a try. Thanks to Dave for his efforts.</p><p> <b>Update:</b> <a href="http://blogs.zdnet.com/community/?p=147">Over on ZDNet</a>, Joe Brockmeier adds his thoughts to the discussion.</p>davorg2008-12-24T09:57:02+00:00journalPerl Training in London
http://use.perl.org/~davorg/journal/38111?from=rss
<p>In conjunction with the UKUUG and O'Reilly, I'm running two days of Perl training in London in February.</p><p>The first day (the 25th) is a beginners' course and the second day (the 26th) is a lot more advanced.</p><p>Full details (including a sign-up form) are <a href="http://www.ukuug.org/events/perl09/">on the UKUUG web site</a>.</p><p>Hope to see some of you there.</p>davorg2008-12-17T16:40:41+00:00journalNew ActiveState PPM build system is live
http://use.perl.org/~brian_d_foy/journal/37827?from=rss
<p>ActiveState tells me that the <a href="http://blogs.activestate.com/activestate/2008/11/new-ppm-servers-in-full-swing.html">new PPM servers are now available</a>. This is the new hotness that <a href="http://aspn.activestate.com/ASPN/Mail/Message/ppm/3642044">Jan Dubious talked about at the beginning of the year</a>.<br>You need the PPM 4 client, which is already in the 5.10 distros and the 5.8 distros since build.</p><p>The new repos have many more modules. These numbers are straight from ActiveState today:</p><blockquote><div><p> <tt>Platform Vers | Old Repo | New Repo (CPANfly)<br>
<br> Linux 5.8 7790 10961<br> Linux 5.10 5611 10888<br>
<br> OS X 5.8 8506 10907<br> OS X 5.10 2662 10878<br>
<br> Windows 5.8 7267 9106<br> Windows 5.10 6524 9060</tt></p></div> </blockquote>brian_d_foy2008-11-08T03:28:22+00:00journalPerl Unsafe Signals
http://use.perl.org/~Matts/journal/37798?from=rss
<p>This is just to document (and place in google) how to do unsafe signals in recent perls without loading a non-core library to do it:</p><blockquote><div><p> <tt> use POSIX qw(SIGALRM);<br> my $timeout = 30;<br> my $sigset = POSIX::SigSet->new(SIGALRM);<br> my $action = POSIX::SigAction->new(<br> sub {<br> # re-install alarm in case we were in an internal eval{} block<br> alarm($timeout);<br> die "timeout working on: " . (caller(1))[1] . "\n";<br> },<br> $sigset,<br> &POSIX::SA_NODEFER, # turns off safe signals<br> );<br> POSIX::sigaction(SIGALRM, $action);<br> my $prev_alarm = alarm($timeout);<br>
<br> eval {<br> # long running code here<br> };<br> my $err = $@;<br> alarm($prev_alarm);<br> if ($err) {<br> if ($err !~<nobr> <wbr></nobr>/timeout working on:/) {<br> die $err; # propogate this error<br> }<br> # process the timeout<br> }</tt></p></div> </blockquote><p>This is written for alarms, which TBH is probably where you really need it, since the regexp engine can get its knickers in a twist and not fire your alarm until the heat death of the universe, but the code will work for other types of signals too.</p><p>And yes, I know there are modules on CPAN for this, such as the excellent and very simple Perl::Unsafe::Signals, but sometimes another module isn't an option. I also know the code is a bit flawed in that the second installation of the alarm doesn't do the right thing (it should install at as $timeout - (time - $start_time)), so feel free to fix it yourself.</p>Matts2008-11-03T20:39:10+00:00journalperlhacks.com
http://use.perl.org/~davorg/journal/37764?from=rss
<p>A few years ago I tried to register the domain perlhacks.com. It wasn't available at the time so I registered the domain perlhacks.org instead. As so often happens, I didn't have time for the project I planned to use it for so it did nothing useful until I made it a redirection to the O'Reilly catalogue page for <a href="http://oreilly.com/catalog/9780596526740/">Perl Hacks</a>. At that point I largely forgot about the domain.</p><p>A couple of weeks ago I got an email from someone telling me that perlhacks.com was for sale. This was a domain reseller and they were targeting me because I already owned the<nobr> <wbr></nobr>.org. They were asking for $997 (but the web page also said 'make us an offer'). They must have been pretty desperate as over the next week or so I got three or four more emails from the same people. They never dropped their price though.</p><p>Today I got another mail from them. And this time when I visited the site the price had dropped to $99. I mentioned this in passing on the #london.pm IRC channel and someone else pointed out that actually the domain had lapsed and was available for anyone to buy. In which case, $99 was far more than you'd expect to pay.</p><p>I checked with my usual domain register and found that the domain was, indeed, available. So I ordered it. Actually three of us ordered it at about the same time and my registry obviously had the fastest systems in place as I got the registration. For less than £10. I then took great pleasure in replying to the people who were trying to sell me the domain telling them what I'd done. I didn't get a reply.</p><p>But now I have both perlhacks.org <i>and</i> perlhacks.com. And I still don't really have a plan for what I'm going to do with them.</p><p>Does anyone have any ideas?</p>davorg2008-10-29T17:41:50+00:00journal