kappa's Journal http://use.perl.org/~kappa/journal/ kappa'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-02-08T17:47:32+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 kappa's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~kappa/journal/ DuckDuckGo runs on Perl http://use.perl.org/~kappa/journal/40445?from=rss There's a cool little search engine called <a href="http://duckduckgo.com/">DuckDuckGo</a>. It is a frequent subject of discussions at Hacker News recently. <p>According to <a href="http://www.gabrielweinberg.com/blog/2009/03/duck-duck-go-architecture.html">the blog post</a> by its creator Gabriel Weinberg it runs on Perl. We don't hear often about successful new projects running on Perl so the more stories like this the better.</p> kappa 2010-07-13T10:23:31+00:00 journal I love indirect object notation http://use.perl.org/~kappa/journal/40374?from=rss <p>I am fond of indirect object notation.</p><p>It's the <tt>my $inst = new Class::Class arg =&gt; 42;</tt> thing. </p><p>It's beautiful and I've never faced any unsolvable problems with it. All arguments against it basically sum up to it being too hard to parse properly. As if we got computers not for this exactly reason &#8212; to do hard things for the sake of <em>beauty</em> (which is a special case of <em>order</em>). </p><p>One example of bad things happening was presented in a <a href="http://www.shadowcat.co.uk/blog/matt-s-trout/indirect-but-still-fatal/">post by Matt Trout</a>. Well, <strong>not convincing</strong>, if I am allowed a slightly offensive quote from Strugatsky brothers here. Do not use it when it causes problems and this particular case seems to be hard to debug due to poor error reporting from perl interpreter only. If <a href="http://search.cpan.org/perldoc?indirect">indirect.pm</a> DOES detect these cases, why perl cannot? Probably because it's too late to change this behaviour in Perl 5. Well, I shut up and return to work.</p> kappa 2010-06-02T13:54:29+00:00 journal Game dynamics in development http://use.perl.org/~kappa/journal/40359?from=rss <a href="http://exogen.github.com/nose-achievements/">This</a> is so cool it almost hurts. Do want! I wonder if it can be implemented around generic TAP. kappa 2010-05-20T21:49:09+00:00 journal Devconf 2010 aftermath http://use.perl.org/~kappa/journal/40355?from=rss <p>This is a shortened version of my mail to <a href="http://www.perlfoundation.org/perl5/index.cgi?events">Perl events mailing list</a>. </p><p>The <a href="http://devconf.ru/">Devconf 2010</a> conference is over and here are some after-thoughts of mine. </p><p>Unfortunately we didn't manage to set up a booth as Gabor Szabo suggested. First, it would cost us money (venue requirement) to display things or even organize some desks with chairs, second &#8212; most of the perl activists were already involved either as speakers or as orgs. The schedule was rather tight but I think the booth would still be effective. Ok, next time. </p><p>We had a nice track with several advocacy and several technical talks. Although Piers Cawley cancelled his talk several days before the conference, Carl Masak did a cool <a href="http://github.com/masak/tardis">tardis</a>/sigmung talk in the big hall (all the other talks were in smaller hall dedicated to Perl track). </p><p>I was unpleasantly surprised by outright hostility towards Perl from Ruby guys both in their talks and informally. I think that they are both wrong and right. First, modern Perl got closer to Ruby, second &#8212; we still hear offensive jokes and remarks about Ruby during YAPC conferences so we probably deserve some retaliation. </p><p>The Python track attracted the most people of all, I think. The PHP track was also crowded and there were many down-to-earth talks for newbies. They were cool. ASP.NET track was almost empty. Ruby track had a lot of interesting talks and they even managed to organize their own lightning talks session (of two talks<nobr> <wbr></nobr>:)). The most interesting for me was the talk about <a href="http://rubini.us/">Rubinius</a> by one of its committers &#8212; a (kinda) successful project to implement Ruby compiler in Ruby. What impressed me most is the courage Ruby people attack such tasks with. They already have around 10 different implementations of Ruby while we still repeat the mantra that only perl can parse Perl. Alas, I am not that fluent in Ruby to know if it is really so much simpler as a language than Perl 5. </p><p>One thing I noted is that there are a lot of "highload" projects implemented in Perl but no in Ruby (I mean locally). This means that Perl people tend to talk about performance, event loops, problems of serving thousands of requests and optimizing server farms. Such talks are not very interesting to a casual application developer. They are too high in the sky. Ruby people talked about simple things and that appealed to more developers. </p><p>The most successful Perl talk was <a href="http://www.slideshare.net/sharifulin/mojolicious-4137390">Anatoly Sharifulin's on Mojolicious <small>(in Russian)</small> </a>. It's very refined, energetic and motivating. Lots of people said that they were pleasantly surprised with features and expressed their wish to come home and remember some Perl-fu for the sake of trying Mojolicious. This is very cool. <a href="http://kapranoff.ru/talks/devconf-2010/perl_myths.html">My own talk <small>(in Russian)</small> </a> based on brilliant Tim Bunce's <a href="http://www.slideshare.net/Tim.Bunce/perl-myths-200909">"Perl Myths"</a> was also very popular. Lots of non-perl people do not know what a gem CPAN is, how huge and at the same time fresh and growing it is. We try to continue discussions on FriendFeed, twitter, LiveJournal and blogs right now. </p><p>All the talks we had on our track are <a href="http://www.perlfoundation.org/perl5/index.cgi?events_2010_devconf_ru">listed here</a>.</p> kappa 2010-05-19T12:22:24+00:00 journal How many Perl developers are there in the world? http://use.perl.org/~kappa/journal/40354?from=rss <p>I'd like to have a rough estimation of the number for a talk. </p><p>First, my own educated guess. We have: </p><ol> <li>~4800 active CPAN authors (<a href="http://stats.cpantesters.org/statscpan.html">from here</a>).</li> <li>1% to 5% of Perl developers release code to CPAN (my own evidence from working in big and small companies).</li> </ol><p>This gets us (optimistically) ~500000 Perl developers in the world. </p><p>Then I did some research^H^H googling: </p><ul> <li> <a href="http://www.perlmonks.org/?node_id=707975">PerlMonks thread</a> with little data. The only interesting comment uses the same method I came up with.</li> <li> <a href="http://www.odinjobs.com/blogs/careers/entry/how_many_perl_php_python">A report from November 2007</a></li> <li> <a href="http://stackoverflow.com/questions/203824/how-many-professional-software-developers-are-there-worldwide">A thread on StackOverflow</a> estimating a total number of software developers in the world.</li> <li> <a href="http://www.theserverside.com/news/thread.tss?thread_id=19476">A piece of news from Sun</a> estimating Java developers in 2000</li> </ul><p>What numbers can you come with?</p> kappa 2010-05-16T09:19:10+00:00 journal Fresh TIOBE http://use.perl.org/~kappa/journal/40299?from=rss According to <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">fresh TIOBE index</a> from PHP/Python/Perl/Ruby only Perl has risen in comparison to April 2009. kappa 2010-04-06T08:23:22+00:00 journal Search CPAN and github simultaneously http://use.perl.org/~kappa/journal/40291?from=rss <p>Here's a simple service to search CPAN and github from one page: <a href="http://perl.worldken.org/">CPAN Hubble</a>. </p><p>It tries to move good github results to the top of the search results page.</p><p>There are several known issues with it but please provide feedback here if you find it as useful as I do.</p> kappa 2010-04-02T21:35:36+00:00 journal Job queues http://use.perl.org/~kappa/journal/40240?from=rss I need a persistent reliable distributed job queue with a good Perl interface. <p> <a href="http://search.cpan.org/dist/TheSchwartz/">TheSchwartz</a> would be great but it looks dead. Brad Fitzpatrick is in the valhalla of Google, last release was in 2008 and cpantesters report more failures than successes. </p><p> <a href="http://gearman.org/">gearman</a> is not reliable. It won't retry jobs on another worker nor workers can return failed jobs. </p><p> <a href="http://github.com/defunkt/resque">Resque</a> is too ruby-specific. </p><p> <a href="http://kr.github.com/beanstalkd/">beanstalkd</a> looks almost fine, but it does not distinguish between job types. You cannot easily register one worker for sending emails and another worker for converting images. </p><p>Should I start looking into various Java-based monstrosities like ActiveMQ?</p> kappa 2010-03-11T22:45:46+00:00 journal Presenting Perl http://use.perl.org/~kappa/journal/40236?from=rss <p>There's a new site by Mark Keating from UK: <a href="http://www.presentingperl.org/">Presenting Perl</a>. It's reportedly based on something called IdiotBox(?!). </p><p>There's also <a href="http://yapc.tv/">YAPC.tv</a> which is more attractive. It also has more features, e.g. RSS feeds. </p><p>And it's too bad that we still have <a href="http://videos.sapo.pt/tag.html?yapceu09">only two videos</a> from YAPC::Europe 2009 available on the web after almost a year and an excplicit written permission from everyone to publish the recordings. </p><p> <i>(surprise) Programmers are more interested in producing tools for content than in producing content.</i></p> kappa 2010-03-10T13:41:40+00:00 journal Wired about serendipity (and Perl) http://use.perl.org/~kappa/journal/40222?from=rss <p>A questionable, but interesting nevertheless <a href="http://www.wired.com/magazine/2010/02/st_essay_distraction/">article in USA Wired</a> mentions Perl:</p><blockquote><div><p><nobr> <wbr></nobr><i>...tweets about Lady Gaga&#8217;s lingerie can help someone debugging Perl code. (Or a tweet about Perl code may help Lady Gaga&#8217;s underwear stylist.)</i></p></div> </blockquote> kappa 2010-03-04T13:16:45+00:00 journal Shutter &#8212; new Gnome screenshot program http://use.perl.org/~kappa/journal/40212?from=rss <p>Perl culture is in dire need of fresh showcases and new success stories. When someone asks about desktop software written in Perl, <a href="http://www.frozen-bubble.org/">FrozenBubble</a> usually springs to mind and then what? </p><p>I think it's very cool that <a href="http://shutter-project.org/">Shutter</a> is written in Perl with all kinds of GNOME goodness like using GooCanvas based on Cairo, installing a notifying icon and being a &#171;Made on Ubuntu&#187; software. </p><p>Try it, it is very feature rich, translated into many languages (my interface is in Russian, e.g.) and a beauty to look at. </p><p>And now I'm going to try to insert some screenshots. Looks like <a href="http://www.slashcode.com/">Slash</a> does not support inline images at all<nobr> <wbr></nobr>:( </p><p>Main window: <a href="http://www.ubuntu-pics.de/bild/44281/__shutter_001_pb6z9g.png">http://www.ubuntu-pics.de/bild/44281/__shutter_001_pb6z9g.png</a>,<br> list of plugins: <a href="http://www.ubuntu-pics.de/bild/44282/shutter______________________002_ry3ohW.png">http://www.ubuntu-pics.de/bild/44282/shutter______________________002_ry3ohW.pn<nobr>g<wbr></nobr> </a></p> kappa 2010-02-26T10:15:28+00:00 journal h-index for CPAN http://use.perl.org/~kappa/journal/40210?from=rss <p>I was researching into scientific activity metrics and calculated the <a href="http://en.wikipedia.org/wiki/H-index">h-index</a> for all CPAN authors as an experiment (I used <a href="http://ali.as/top100/">CPANDB</a> by a very high h-indexed CPAN author). </p><p>The above linked Wikipedia article has all the gory details about the index, but I calculated it as follows: <i>"An author X has h-index of H if he has at least H distributions each of which is a runtime dependency for at least H distributions by other CPAN authors".</i> </p><p>Strictly speaking this is not the h-index proper. I used CPAN dependencies as an equivalent of bibliographic citations. Here's everyone with h-index &gt; 5:</p><blockquote><div><p> <tt>Adam Kennedy&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 19<br>Dave Rolsky&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;16<br>Florian Ragwitz&nbsp; &nbsp; &nbsp; &nbsp;14<br>Ricardo Signes&nbsp; &nbsp; &nbsp; &nbsp; 13<br>Gisle Aas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;11<br>David Golden&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9<br>Graham Barr&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8<br>Steffen Mueller&nbsp; &nbsp; &nbsp; &nbsp;8<br>Alexandr Ciornii&nbsp; &nbsp; &nbsp; 7<br>Damian Conway&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7<br>Tatsuhiko Miyagawa&nbsp; &nbsp; 7<br>Michael G Schwern&nbsp; &nbsp; &nbsp;7<br>Andy Lester&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7<br>Richard Clamp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7<br>Chris Williams&nbsp; &nbsp; &nbsp; &nbsp; 6<br>Tomas Doran&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6<br>Ingy dot Net&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6<br>Marc Lehmann&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6<br>Yuval Kogman&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6</tt></p></div> </blockquote><p>By the way, 6875 of 8029 CPAN authors have h-index of zero. </p><p>I don't know whether my restriction of runtime-phase dependencies invalidates the calculation due to inaccurate data. Will run the suite without it tomorrow. </p><p>Here's the gist of the code (it's 6 a.m. here in Moscow and I may very well have gone totally nuts):</p><blockquote><div><p> <tt>sub hindex($author) {<br>&nbsp; &nbsp; my $res =<br>&nbsp; &nbsp; $dbh-&gt;selectall_arrayref('<br>&nbsp; &nbsp; &nbsp; &nbsp; select d.distribution, count(dep.distribution) as deps<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from distribution d, dependency dep, distribution d2<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; where&nbsp; &nbsp;d.author = ?<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and dep.dependency = d.distribution<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and dep.phase = "runtime"<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and d2.distribution = dep.distribution<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and d2.author != ?<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group by d.distribution<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; order by deps desc<br>&nbsp; &nbsp; &nbsp; &nbsp; ',<br>&nbsp; &nbsp; &nbsp; &nbsp; undef, $author, $author);<br> <br>&nbsp; &nbsp; my $h = 0;<br>&nbsp; &nbsp; while ($res-&gt;[$h] &amp;&amp; $res-&gt;[$h]-&gt;[1] &gt; $h) {<br>&nbsp; &nbsp; &nbsp; &nbsp; $h++;<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; return $h;<br>}</tt></p></div> </blockquote><p>This is not pure Perl, it's Perl with <a href="http://search.cpan.org/dist/signatures/">signatures</a> which I totally love.</p> kappa 2010-02-25T03:04:37+00:00 journal .. &amp; ... http://use.perl.org/~kappa/journal/40116?from=rss <p>I'm publishing one of the tricky questions I ask when I interview people for Perl developer positions.</p><p>"Tell me about<nobr> <wbr></nobr>.. and<nobr> <wbr></nobr>... operators? How are they different? How do they work in different contexts?" &#169; skv++</p><p>Why it is a bad question: nobody (and I mean, really, nobody) ever uses these operators in scalar context. The only way to really know them is to have literally learnt all the perlop by heart. I once did it because I studied Perl offline and the information to feed upon was very scarce.</p><p>Why it is a good question: it allows me to know whether the man understands Perl contexts in 30 seconds.</p><p>IMHO, this question brings more grief than benefit so I hereby decide to ditch it. Hooray!</p> kappa 2010-01-21T14:15:31+00:00 journal s/perl/work/ http://use.perl.org/~kappa/journal/39842?from=rss This is funny but silly. Android (HTC Hero) text correction does not contain word "perl" and suggests "work" as the most probable correction. kappa 2009-11-04T18:47:17+00:00 journal vim is Perl of text editors http://use.perl.org/~kappa/journal/39785?from=rss Messy but in good ways. kappa 2009-10-22T06:39:43+00:00 journal Packaging Perl modules for Ubuntu http://use.perl.org/~kappa/journal/39733?from=rss <p>There were a series of packaging tutorials on Ubuntu IRC in July and the most interesting for me was the Packaging Perl Modules session. </p><p>I'm a long FreeBSD user (I started with 2.2.7 on my home Pentium 166MMX box in 1998) and only recently switched to Ubuntu Linux on my desktop and laptop. The <tt>apt</tt> system of packages inherited from Debian seemed too complex for me especially in comparison with the beautiful and simple FreeBSD Ports collection. </p><p>I submitted a lot of perl ports to FreeBSD and it was high time for me to try to package something for my new desktop. So this session came handy. I was not able to attend it personally but the <a href="https://wiki.ubuntu.com/Packaging/Training/Logs/2009-07-23">IRC log</a> was made available by the good Ubuntu folks almost instantly. </p><p>It's an interesting read. The system is really very complex compared to the Ports but there are a lot of utilities helping achieve common tasks. It almost looks like <tt>git</tt> compared to <tt>cvs</tt> (and I loved cvs too!) </p><p>This is the link once again: <a href="https://wiki.ubuntu.com/Packaging/Training/Logs/2009-07-23">https://wiki.ubuntu.com/Packaging/Training/Logs/2009-07-23</a></p> kappa 2009-10-09T08:26:31+00:00 journal \w in perl 5.11.0 http://use.perl.org/~kappa/journal/39722?from=rss <p>There's an interesting and slightly disturbing change mentioned in <a href="http://search.cpan.org/~jesse/perl-5.11.0/pod/perl5110delta.pod#Unicode_interpretation_of_%5Cw,_%5Cd,_%5Cs,_and_the_POSIX_character_classes_redefined.">delta for 5.11</a>:</p><blockquote><div><p> <i> The key change here is that \d will no longer match every digit in the unicode standard (there are thousands) nor will \w match every word character in the standard, instead they will match precisely their POSIX or Perl definition. </i></p></div> </blockquote><p>The interesting part here is that (besides fixing the problems mentioned in the document) <tt>\w</tt> is going to match a very small and tight set of characters <tt>[0-9A-Z_a-z]</tt> and may become faster for Unicode strings. The disturbing part is that it stops matching non-ASCII letters which of course includes Cyrillics that I depend on. </p><p>It happened that this change is not yet implemented in full &#8212; see <a href="http://www.perlmonks.org/?node_id=799249">the node I wrote yesterday on Perlmonks</a> and especially demerphq's comments. </p><p>I should make myself comfortable at using <tt>\p</tt> and <tt>\P</tt> escapes with Unicode properties just in case. They were implemented almost 10 years ago and I never trusted them enough to start using. That's probably ridiculous.</p> kappa 2009-10-06T12:53:25+00:00 journal planetperl.ru launch http://use.perl.org/~kappa/journal/39707?from=rss <p>Last week I launched a new &#171;planet&#187; &#8212; <a href="http://planetperl.ru/">planetperl.ru</a> aggregates all posts about Perl from Russian blogosphere. <a href="http://moscow.pm.org/">Moscow.pm</a> collective conscience has long wanted to do that and I had several days of spare time all to myself so I did it. </p><p>Five days after launch we have 79 feeds and a <a href="http://github.com/kappa/perlanet">heavily patched Perlanet</a> instance happily running and broadcasting the news to almost 150 subscribers counting all the channels (in addition to Atom feed we have Twitter and FriendFeed feeds, LiveJournal syndicated account and a surprisingly popular automatic email newsletter). We also have a Google Custom Search Engine configured to crawl the sites included in the planet. The search function turned out to be very useful in such configuration. </p><p>Gabor Szabo advised me to blog about the site in English so it can be used as an example of a local non-English project. Well, here I am writing my first post to my use.perl journal and applying for IronMan inclusion at the same time<nobr> <wbr></nobr>:) </p><p>The engine behind the site is Perlanet &#8212; a synchronous Planet clone written by Dave Cross. I have patched it for Unicode compliance, rewritten the fetcher to use URI::Fetch with caching and added a very simple filtering system. Everything is hosted in the open on github. See <a href="http://github.com/kappa/perlanet">http://github.com/kappa/perlanet</a> and <a href="http://github.com/kappa/planetperl.ru">http://github.com/kappa/planetperl.ru</a> if interested. Perlanet runs from cron and generates static files which are served by <a href="http://nginx.net/">nginx</a>. This architecture will not let us move any closer to real-time but is very simple and quite robust.</p> kappa 2009-10-03T18:47:04+00:00 journal