rafael's Journal
http://use.perl.org/~rafael/journal/
rafael's use Perl Journalen-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:01:51+00:00pudgepudge@perl.orgTechnologyhourly11970-01-01T00:00+00:00rafael's Journalhttp://use.perl.org/images/topics/useperl.gif
http://use.perl.org/~rafael/journal/
Code freeze for 5.10
http://use.perl.org/~rafael/journal/34730?from=rss
I just announced the <a href="http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2007-10/msg00602.html">beginning of the code freeze for the release of perl 5.10.0</a>.rafael2007-10-22T10:15:22+00:00journalLOLPUMPKING
http://use.perl.org/~rafael/journal/33837?from=rss
<a href="http://www.flickr.com/photos/rgarciasuarez74/843736703/">LOLPUMPKING</a>.
<p>
I'm sorry.
I'm so sorry.</p>rafael2007-07-18T09:06:09+00:00journalencoding::source
http://use.perl.org/~rafael/journal/33565?from=rss
I'm happy to announce to the unsuspecting world that I've released to the CPAN a new Perl module, <a href="http://search.cpan.org/dist/encoding-source"> <tt>encoding::source</tt> </a>. Like I say in the docs, this is like the <tt>encoding</tt> pragma, but done right. In other words, it allows you to change, on a per-file or per-block basis, the encoding of the string literals in your programs.
<p>
That's probably some of the scariest Perl code I've written. Note that it won't run on any released perl. You'll nead bleadperl (or the upcoming 5.9.5) for that. That's because it uses the new support for user-defined lexical pragmas.
</p><p>
<i>(also published at <a href="http://consttype.blogspot.com/2007/06/encodingsource.html">consttype</a>)</i></p>rafael2007-06-21T08:04:09+00:00journalBlogger
http://use.perl.org/~rafael/journal/33156?from=rss
I decided to try Blogger, because that eats less tuits than hosting one's own general-purpose log. (Perl stuff will remain here.) So here's the very first attempt (still rough): <a href="http://consttype.blogspot.com/">ConstType</a>. (I don't expect you to fully understand the threefold meaning of the title if you're not fluent in French.) -- (oh, and for a first post, don't expect something really interesting, of course.)rafael2007-04-30T11:40:45+00:00journalThe Perl Unicode FAQ
http://use.perl.org/~rafael/journal/32618?from=rss
I think I should mention that Juerd contributed a <a href="http://rgarciasuarez.free.fr/tmp/perlunifaq.html">Perl Unicode FAQ (perlunifaq)</a> to bleadperl. It probably deserves a wider audience than the little P5P circle.
<p>
(Of course, comments welcome. Send them to P5P.)</p>rafael2007-03-08T17:09:10+00:00journalPHP security
http://use.perl.org/~rafael/journal/31879?from=rss
We all know that, due to the poor design of the language, security and PHP applications don't mix well, because PHP makes writing secure code difficult; <a href="http://blog.php-security.org/archives/61-Retired-from-securityphp.net.html">apparently</a> security doesn't mix well either with the mindset of the PHP core developers.rafael2006-12-11T11:43:27+00:00journalNeat Grammar Graphs
http://use.perl.org/~rafael/journal/31708?from=rss
(Seen via LtU)<p>
Nobody wants to make a Perl grammar graph, similar to the ones found <a href="http://blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar">here</a> for Ruby, JavaScript and Java? Bonus points if you include a Perl 1 grammar and a Perl 5.9.4 or bleadperl grammar.</p>rafael2006-11-24T09:34:58+00:00journalNew features in bleadperl
http://use.perl.org/~rafael/journal/31489?from=rss
I added two features in bleadperl recently:<blockquote><div><p> <tt># new prototype character !<br># _ is just like $, except that it defaults to $_<nobr> <wbr></nobr>:<br>sub foo (_) {<br> print "<@_>\n";<br>}<br>foo(42); # prints <42><br>foo(); # equivalent to foo($_)</tt></p></div> </blockquote><p>And another one, you can now override <tt>readpipe()</tt><nobr> <wbr></nobr>:</p><blockquote><div><p> <tt>BEGIN{<br> *CORE::GLOBAL::readpipe = sub($){<nobr> <wbr></nobr>... }<br>}<br>qx/foo/; # calls the function with "foo" as argument<br>`foo`; # same thing</tt></p></div> </blockquote>rafael2006-11-02T12:42:39+00:00journalAnniversary
http://use.perl.org/~rafael/journal/31403?from=rss
I'm <tt>0x20</tt> years old today. Not a teenager anymore<nobr> <wbr></nobr>:)rafael2006-10-24T08:04:37+00:00journalVacations
http://use.perl.org/~rafael/journal/30634?from=rss
So, Perl 5.9.4 is <a href="http://search.cpan.org/~rgarcia/perl-5.9.4/">out</a>. And 5.10 begins to appear real close now. I wanted to release a development snapshot before YAPC::EU, as a basis for work and test, for us perl5ers but also for the lambdacamels. I hope everyone will enjoy. Meanwhile, I'm taking a short vacation in Nice (France). See you in Birmingham maybe! (If I manage to get a plane...)rafael2006-08-15T16:19:21+00:00journalWithout strict, it's lighter
http://use.perl.org/~rafael/journal/30526?from=rss
Found in some build script:<blockquote><div><p> <tt>perl -pi -e 's/^use strict/#use strict/g' someprog.pl</tt></p></div> </blockquote><p>You know, guys, removing "strict" from your code before deployment is a bit like removing the safety belt from your car, thinking that without those few dozen grams, it's going to be faster.</p>rafael2006-08-04T14:51:52+00:00journalAxaxaxas mlo
http://use.perl.org/~rafael/journal/30515?from=rss
Since everyone speaks about the <a href="http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html">kingdom of Nouns</a>, I'd like to point my readers to that short story by Borges, <i> <a href="http://interglacial.com/~sburke/pub/Borges_-_Tlon,_Uqbar,_Orbis_Tertius.html">Tlôn, Uqbar, Orbis Tertius</a> </i>, which describes a kingdom of verbs.<p>Here's an excerpt:</p><blockquote><div><p> <i>There are no nouns in Tlön's conjectural Ursprache, from which the "present" languages and the dialects are derived: there are impersonal verbs, modified by monosyllabic suffixes (or prefixes) with an adverbial value. For example: there is no word corresponding to the word "moon,", but there is a verb which in English would be "to moon" or "to moonate." "The moon rose above the river" is hlor u fang axaxaxas mlo, or literally: "upward behind the onstreaming it mooned."</i></p></div> </blockquote>rafael2006-08-02T14:24:45+00:00journalNo piano for you
http://use.perl.org/~rafael/journal/30507?from=rss
I have distorted my right thumb, by carrying heavy stuff. Now I have to train my hands to type on the space bar with my left thumb... and it's awfully difficult.rafael2006-08-02T07:48:58+00:00journalExtraordinary gentlemen
http://use.perl.org/~rafael/journal/30394?from=rss
So, I have seen this movie, <a href="http://www.imdb.com/title/tt0311429/">the league of extraordinary gentlemen</a>. I hated it. No characters, merely puppets. Barely a plot. CGI and action scenes for action's sake. In one word, void.<p>That said, I liked very much all Alan Moore comics I've read -- the Watchmen, V for Vendetta, From Hell. So, tell me that the comic book is worth it and better than the movie. Please<nobr> <wbr></nobr>:)</p>rafael2006-07-24T06:42:56+00:00journalPropaganda for the people, by the people
http://use.perl.org/~rafael/journal/30190?from=rss
People are getting good at manipulation of images. Here's two recent examples,
thanks to the Internet. <p> First, a <a href="http://pinkdome.com/archives/2006/06/best_video_ever.html">video</a> made
out of Bush speeches, remixed into a speedy version of <i>Sunday Bloody
Sunday</i>.
Secondly, a <a href="http://jwz.livejournal.com/656821.html">Liberty holding a cross</a>.
</p><p>Both are effective, shocking, memorable. Both work on the same principle:
putting "opposites" together -- Bush and a pacifist song, Christianism and a symbol
of civil liberties. But both have the same problem. They suppress any possibility
of dialogue and argumentation, because they suppress that interval between "opposites":
and I put "opposites" between quotes because Bush is much more complex than
an anti-pacifist, and Christianism is much more complex than an anti-liberty ideology.
Actually, reducing Bush to an anti-pacifist and Christians to supporters of theocracy
is so caricatural is becomes ridiculous and plain false.</p><p>
So those images are also manipulations. Effective and well-done manipulations, but not
so far from propaganda. With the context, you can tell that the song is anti-Bush,
and that the statue is pro-Christian. But put the very same statue in some museum
of modern art and it becomes anti-Christian. Quoting <i>1984</i> again, war is peace,
slavery is freedom: when the opposites are joined there is not place left for
thought.</p><p>And that's why in the end I don't like those images.</p>rafael2006-07-06T06:12:33+00:00journalNew tuits
http://use.perl.org/~rafael/journal/29520?from=rss
After some hard times (work related, mainly), I happy to announce I seem to have got some tuits back. Here's what I did this evening, implementing a new keyword, <tt>state</tt>, which is a Perl 6 thing and that appears in the <a href="http://search.cpan.org/~rgarcia/perl-5.9.3/pod/perltodo.pod#state_variables">latest perltodo manpage</a>.<blockquote><div><p> <tt>$ bleadperl -Mfeature=state -wle 'sub f { state $x = 42; print $x++ } f; f; f'<br>42<br>43<br>44</tt></p></div> </blockquote><p>This, of course, brand new and subject to change; more about that in David Landgren's next wonderful P5P summary!</p>rafael2006-05-03T22:15:19+00:00journalIndentation constraints and Python design
http://use.perl.org/~rafael/journal/28662?from=rss
Interesting quote by Guido about the language design principles that guide python's evolution<nobr> <wbr></nobr>:<blockquote><div><p> <i>I find any solution unacceptable that embeds an indentation-based block in the middle of
an expression. Since I find alternative syntax for statement grouping (e.g. braces or begin/end keywords) equally unacceptable, this pretty much makes a multi-line lambda an unsolvable puzzle.</i> --
<a href="http://www.artima.com/weblogs/viewpost.jsp?thread=147358">Language Design Is Not Just Solving Puzzles</a></p></div>
</blockquote><p>
(via <a href="http://lambda-the-ultimate.org/node/1298">LtU</a>)
</p><p>So, choice of basic grammar rules has an influence on language features -- nothing really new here. Perl 5 and Perl 6 have complex, expressive syntax, where blocks in expressions are familiar, because easy to do. That doesn't mean they're necessarily superior at every point of view. But that shows they're optimized for versatility; while Python's grammar is constantly changing, sometimes without ensuring backwards compatibility. In Perl 5 you can have idioms, or new programming paradigms (look at how Catalyst uses attributes for example), while being able to run Perl 4 scripts. That would be another advocacy point. Get the new cool stuff without throwing away the old one.</p>rafael2006-02-13T10:06:05+00:00journalToday's vim trick
http://use.perl.org/~rafael/journal/28474?from=rss
Drop this in file <i>~/.vim/ftplugin/pod_podchecker.vim</i><nobr> <wbr></nobr>:<blockquote><div><p> <tt>set makeprg=podchecker\ -warnings\ %\ 2>&1\\\|sed\ 's,at.line,:&,'<br>set errorformat=%m:at\ line\ %l\ in\ file\ %f</tt></p></div> </blockquote><p>Then, when editing a<nobr> <wbr></nobr>.pod file, you can<nobr> <wbr></nobr><tt>:make</tt> it; and then the command<nobr> <wbr></nobr><tt>:cope</tt> will open a nice little window with all pod errors and warnings, correctly recognized, so you can jump on the corresponding lines in the pod source file only by selecting them.</p>rafael2006-01-26T13:45:34+00:00journalToday's disgusted moment
http://use.perl.org/~rafael/journal/28342?from=rss
Sometimes, language programming constructs are just <a href="http://mail.python.org/pipermail/python-dev/2005-September/056846.html">objectively ugly</a>. (Or do I do too much C programming ? No. I don't want to believe that.)rafael2006-01-13T18:09:35+00:00journalman2pod
http://use.perl.org/~rafael/journal/27502?from=rss
Ever wanted a man-to-POD converter? Such a thing exists, and apparently does a good job at guessing formats, from my first tests. It's called <a href="http://polyglotman.sourceforge.net/">PolyglotMan</a>. It can also convert man pages to html, latex, rtf, and other formats.
<p>Funnily, on my Mandriva system, it comes as part of the xorg-x11 package<nobr> <wbr></nobr>:</p><blockquote><div><p> <tt>$ rman --version<br>PolyglotMan v3.0.8+X.Org</tt></p></div> </blockquote>rafael2005-11-07T17:01:36+00:00journalPerl::Unsafe::Signals
http://use.perl.org/~rafael/journal/27146?from=rss
Yesterday I uploaded <tt> <a href="http://search.cpan.org/~rgarcia/Perl-Unsafe-Signals-0.01/Signals.pm">Perl::Unsafe::Signals</a> </tt> to the CPAN. A bit of XS, a bit of a source filter, and you're now theoretically able to turn on unsafe signals behaviour (see <tt>PERL_SIGNALS</tt> in the <i>perlrun</i> manpage) on a per-block basis. However, it's completely untested yet.rafael2005-10-13T11:58:39+00:00journalFlickr
http://use.perl.org/~rafael/journal/26679?from=rss
Yay, I got a Flickr account. It's at
<a href="http://www.flickr.com/photos/rgarciasuarez74/">http://www.flickr.com/photos/rgarciasuarez74/</a>.rafael2005-09-11T19:10:10+00:00journalA subversion tip
http://use.perl.org/~rafael/journal/26617?from=rss
I think this can be useful to some.
<p> <i>
<@acme> Nicholas: svn diff annoys me too<br>
<@rgs> what's wrong with svn diff ?<br>
<@Nicholas> rgs: <a href="http://nick.hates-software.com/">http://nick.hates-software.com/</a> <br>
<@rgs> Nicholas: you need to edit diff-cmd in ~/.subversion/config<br>
<@Nicholas> from what to what?<br>
<@rgs> I have this<nobr> <wbr></nobr>:<br>
<@rgs> ### Set diff-cmd to the absolute path of your 'diff' program.<br>
<@rgs> ### This will override the compile-time default, which is to use<br>
<@rgs> ### Subversion's internal diff implementation.<br>
<@rgs> diff-cmd =<nobr> <wbr></nobr>/usr/bin/diff<br>
<@rgs> and svn di -x-dpubB works flawlessly<nobr> <wbr></nobr>:)<br>
<@rgs> ok, it's poorly documented.</i></p>rafael2005-09-06T11:01:48+00:00journalShakti, a Perl 6 bot
http://use.perl.org/~rafael/journal/26426?from=rss
Hmm, so, I wrote a very simple IRC bot in Perl 6 yesterday evening. It's a karmabot -- it implements the foo++ and bar-- commands that are familiar to purl's friends. Currently found as shakti on #mandrivafr on freenode. (Yes, karma, shakti, all that kind of stuff, we wanted to find a female sanskrit name.)
<p>Here's the code, derived from examples/network/bot_irc.p6 in the pugs sources. Suggestions to make it more perl6ish welcome!</p><blockquote><div><p> <tt>#!/usr/bin/pugs<br> <br>use v6;<br> <br>my $nick = "shakti";<br>my $server = "irc.freenode.net";<br>my $chan = "#mandrivafr";<br>my %karma;<br>my %sux = (<br> php => 1,<br> python => 1,<br>);<br>my %rulz = (<br> perl => 1,<br> perl6 => 1,<br>);<br>my $karmafile = '/tmp/shakti.dump';<br> <br>sub dump_karma {<br> my $fh = open($karmafile,<nobr> <wbr></nobr>:w) err say "Can't open $karmafile";<br> $fh.say("$_:%karma{$_}") for keys %karma;<br> $fh.close;<br>}<br> <br># load karma<br>my $fh = open $karmafile err die "Can't load $karmafile";<br>for =$fh {<br> $_<nobr> <wbr></nobr>.= chomp;<br> my ($k, $v) = split ":", $_;<br> %karma{$k} = $v;<br>}<br>$fh.close;<br> <br>my $hdl = connect($server, 6667);<br> <br>say "Connected to $server";<br> <br>$hdl.say("NICK $nick\nUSER $nick $nick $nick $nick");<br>$hdl.flush;<br> <br># discard first line<br>my $ligne = readline($hdl);<br> <br>$hdl.say("JOIN $chan");<br>$hdl.flush;<br> <br>say "Joined $chan";<br> <br>while $ligne = =$hdl {<br> <br> $ligne<nobr> <wbr></nobr>.= chomp;<br> <br> given $ligne {<br> <br> when rx:perl5/^PING/ {<br> $hdl.say("PONG $nick");<br> $hdl.flush;<br> }<br> <br> when rx:perl5/^:(.*?)!.*? PRIVMSG $chan (.*)/ {<br> my $nick = $0;<br> my $msg = $1;<br> given $msg {<br> when rx:perl5/(\w+)\+\+/ {<br> if $nick eq $0 {<br> $hdl.say("PRIVMSG $chan<nobr> <wbr></nobr>:$nick: you can't up your own karma!");<br> }<br> else {<br> %karma{lc $0}++;<br> say "increment $0";<br> dump_karma();<br> }<br> }<br> when rx:perl5/(\w+)--/ {<br> %karma{lc $0}--;<br> say "decrement $0";<br> dump_karma();<br> }<br> when rx:perl5/\bkarma\s+(\w+)/ {<br> if $0 eq "shakti" {<br> $hdl.say("PRIVMSG $chan<nobr> <wbr></nobr>:I have infinite karma");<br> }<br> elsif %sux{lc $0} {<br> $hdl.say("PRIVMSG $chan<nobr> <wbr></nobr>:$0 has very, very bad karma");<br> }<br> elsif %rulz{lc $0} {<br> $hdl.say("PRIVMSG $chan<nobr> <wbr></nobr>:$0 has infinite karma");<br> }<br> elsif %karma{lc $0} {<br> $hdl.say("PRIVMSG $chan<nobr> <wbr></nobr>:$0 has karma of " ~ %karma{lc $0});<br> }<br> else {<br> $hdl.say("PRIVMSG $chan<nobr> <wbr></nobr>:$0 has neutral karma");<br> }<br> $hdl.flush;<br> }<br> }<br> }<br> <br> };<br> <br>}</tt></p></div> </blockquote>rafael2005-08-23T07:49:12+00:00journalTest::LongString 0.08
http://use.perl.org/~rafael/journal/26092?from=rss
I just uploaded <tt>Test::LongString</tt> 0.08 to CPAN, in which a bug was fixed and a new feature implemented [look for <tt>$Context</tt> in the docs], during the <i> <a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/7002">Practical Perl Testing</a> </i> talk. Thanks to whoever asked a question about it during the talk -- the idea comes from him !rafael2005-08-04T16:42:38+00:00journalAirtight
http://use.perl.org/~rafael/journal/24903?from=rss
It occurs to me that Moebius' most excellent comic book <a href="http://fr.wikipedia.org/wiki/Le_Garage_herm%C3%A9tique">Le garage hermétique</a> [from which my workstation's hostname comes] has been canonically translated into English as the <a href="http://en.wikipedia.org/wiki/Airtight_Garage">Airtight Garage</a>, thus removing the implicit but probably evident reference to <a href="http://en.wikipedia.org/wiki/Hermeticism">Hermes Trismegistus</a>.
<p>I also note the interesting fact that <a href="http://en.wikipedia.org/wiki/Image:GiordanoBrunomnemonic.gif">this picture</a> appeared on my defunct blog some years ago, and comes probably from there<nobr> <wbr></nobr>:)</p>rafael2005-05-27T08:50:29+00:00journalPrefacing
http://use.perl.org/~rafael/journal/24738?from=rss
By the way, I forgot to mention that I wrote the preface of <a href="http://www.eyrolles.com/Informatique/Livre/9782746210325/livre-de-perl-a-java.php">this book</a> by Philippe Verdret. Its title, translated to English, would be <i>From Perl to Java: Programming with Regular Expressions</i>. (Wow, 3rd entry. It's journal-day !)rafael2005-05-17T15:06:19+00:00journalOne-click installation
http://use.perl.org/~rafael/journal/24734?from=rss
I wasn't too happy to see that this <a href="http://www.zegeniestudios.net/ldc/index.php">Linux Distribution Chooser</a> (found via del.icio.us) asserts that Mandriva Linux doesn't support "one-click software installation". I wonder what they mean by that.
<p>Oh, and they also claim that our distribution isn't free. So why can you <a href="ftp://ftp.free.fr/mirrors/ftp.mandrake-linux.com/Mandrakelinux/devel/iso/">download ISOs</a> ? And all rpms of free software we produce is available on mirrors, even when not found in the distribution ISOs.
</p><p>In short, a web site with pretty graphics and all, but they failed to get their facts right.</p>rafael2005-05-17T12:48:06+00:00journalSub::Identify
http://use.perl.org/~rafael/journal/24666?from=rss
After an idea by Chia-Liang Kao, of svk fame, I uploaded <a href="http://search.cpan.org/~rgarcia/Sub-Identify-0.01/lib/Sub/Identify.pm">Sub::Identify</a> to CPAN.rafael2005-05-13T11:57:51+00:00journalPerl 6 cheerleader lines
http://use.perl.org/~rafael/journal/24359?from=rss
Inspired by a remark of Larry, and by the fact that some of the Perl 5 annoyances won't be fixed in Perl 5, I came up with a few Perl 6 cheerleader lines.<blockquote><div><p> <i>Fix in six / Fix in six / With much better semantics
<br>
Fix in six / Fix in six / That's the best of all gimmicks
<br>
Fix in six / Fix in six / And learn a few new cool tricks
<br>
Fix in six / Fix in six / And we'll take over Unix
<br>
Fix in six / Fix in six / With a few keystrokes and clicks
<br>
Fix in six / Fix in six / You will need a new remix
<br>
Fix in six / Fix in six / Or maybe in sixty-six
<br>
Fix in six / Fix in six / And kill all the heretics
<br>
Fix in six / Fix in six / Much more than just aesthetics
<br>
Fix in six / Fix in six / Sing all the perl-a-holics
<br>
Fix in six / Fix in six / From Larry Wall's alembics
<br>
Fix in six / Fix in six / Best of all pharmaceutics
<br>
Fix in six / Fix in six / As prove all the statistics
<br>
Fix in six / Fix in six / Cures even syphilitics
</i></p></div>
</blockquote><p>
I'll get my coat.</p>rafael2005-04-25T09:32:24+00:00journal