dami's Journal http://use.perl.org/~dami/journal/ dami'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:37:44+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 dami's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~dami/journal/ Joining the Ironman challenge (finally) http://use.perl.org/~dami/journal/39418?from=rss <p>After months of delaying the decision, I finally decided I had to join the Ironman planet and go blogging</p><p>. </p><p>The blog will not be on use.perl, but rather <a href="http://ldami.blogspot.com/">there</a>. </p><p>Please stay in tune!</p><p>.</p> dami 2009-08-08T12:37:21+00:00 journal Server-side MsWord document generation http://use.perl.org/~dami/journal/38234?from=rss <p>I've been using the wonderful Spreadsheet::WriteExcel for a while, and was annoyed of not having an equivalent module for server-side MsWord document generation. </p><p> Now I finally found a solution : compose the doc. in HTML, add some MsWord-specific markup for page setup, wrap the whole thing in a MIME-multipart file<nobr> <wbr></nobr>... and there it is, a document generated without MsOffice, but nevertheless with headers, footers, pagination, etc. </p><p> This has been wrapped in an initial module <a href="http://search.cpan.org/~dami/MsOffice-Word-HTML-Writer-0.03/lib/MsOffice/Word/HTML/Writer.pm">MsOffice::Word::HTML::Writer</a>. Still lacking tests and examples, but already functional. Improvement suggestions are welcome! </p> dami 2009-01-08T04:05:16+00:00 journal ANNOUNCE: DBIx::DataModel 1.04 http://use.perl.org/~dami/journal/37572?from=rss <p>DBIx::DataModel v1.04 has been released to CPAN. This is<br>a major revision from previous v0.35, with several architectural<br>changes and added functionalities.</p><p>DBIx::DataModel is an Object-Relational mapping layer (ORM). Some of its<br>strong points are :</p><p>- UML-style declaration of relationships (instead of 'has_many',<br> &nbsp; &nbsp; 'belongs_to', etc.)</p><p>- efficiency through fine control of collaboration with the<br> &nbsp; &nbsp; DBI layer (prepare/execute, fetch into reusable memory location, etc.)</p><p>- improved API for SQL::Abstract (named parameters, simplified 'orderBy')</p><p>- clear conceptual distinction between<br> &nbsp; &nbsp; &nbsp; &nbsp; - data sources (tables and views),<br> &nbsp; &nbsp; &nbsp; &nbsp; - database statements (stateful objects representing stepwise building<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; of an SQL query and stepwise retrieval of results),<br> &nbsp; &nbsp; &nbsp; &nbsp; - data rows (lightweight hashrefs containing nothing but column<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; names and values)</p><p>- joins with simple syntax and possible override of default<br> &nbsp; &nbsp; INNER JOIN/LEFT JOIN properties; instances of joins multiply<br> &nbsp; &nbsp; inherit from their member tables</p><p>- named placeholders at the ORM level</p><p>- nested, cross-database transactions</p><p>The synopsis is in<br><a href="http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel.pm">http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel.pm</a>;<br>the design principles and general architecture are explained<br>in <a href="http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel/Doc/Design.pod">http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel/Doc/Design.pod</a></p> dami 2008-09-30T00:06:56+00:00 modules XS is fun http://use.perl.org/~dami/journal/36729?from=rss <p>So far I had always looked at XS code as dark, unknown territory.</p><p>Recently I had to jump into it because we really needed support for custom-made collations in SQLite, and nobody had done it so far (you know, there are those strange foreign languages like french where you want accented characters when you write, and you want to ignore accents when you search).</p><p>The DBD::SQLite driver already has support for other function hooks, so these were nice examples. And I was very pleased to find that XS authoring is very well documented in the standard perldoc. So after all it was fun !</p><p>I hope the patch will be integrated some day in a next release of the driver; meanwhile, if you are in a hurry with the same need, you can get the patch at http://rt.cpan.org/Ticket/Display.html?id=34828. There is also support for a hook into SQLite's progress_handler. Enjoy.</p> dami 2008-06-19T20:26:26+00:00 journal package in main file : careful with initializations! http://use.perl.org/~dami/journal/35782?from=rss A colleague of mine came with a program looking more or less like this. What do you think is the output ?<blockquote><div><p> <tt>&nbsp; use strict;<br>&nbsp; use warnings;<br> <br>&nbsp; my $obj = Obj-&gt;new(11);<br>&nbsp; print $obj-&gt;meth, "\n";<br> <br>&nbsp; #-----------<br>&nbsp; package Obj;<br>&nbsp; #-----------<br>&nbsp; use strict;<br>&nbsp; use warnings;<br> <br>&nbsp; my $foo = 22;<br>&nbsp; my $bar = 33;<br> <br>&nbsp; sub new {<br>&nbsp; &nbsp; my ($class, $arg) = @_;<br>&nbsp; &nbsp; my $self = bless {arg =&gt; $arg}, $class;<br>&nbsp; }<br> <br>&nbsp; sub meth {<br>&nbsp; &nbsp; my ($self) = @_;<br>&nbsp; &nbsp; return "$self-&gt;{arg} / $foo / $bar";<br>&nbsp; }</tt></p></div> </blockquote><p> It looks so obvious : the answer must be <tt>11 / 22 / 33</tt>. But this is wrong! We get trapped by being so used to external packages, where everything is initialized at load time. </p><p> Here, everything is in the same file. So the main program starts, <tt>new</tt> and <tt>meth</tt> get called <b>before</b> <tt>$foo</tt> and <tt>$bar</tt> are initialized, and the result is <tt>11 / / </tt>, with a warning about uninitialized values! </p> dami 2008-02-27T19:23:48+00:00 bugs plat_forms report published June 20th, 2007 http://use.perl.org/~dami/journal/33559?from=rss <p> The results and final report of the "Plat_forms" international programming contest were released yesterday in a press conference in Nuremberg, and will be published today June 20th, 2007 on <a href="http://www.plat-forms.org/">http://www.plat-forms.org/</a>. </p><p> For each of the categories Perl, PHP and Java, three teams of three people each competed to produce a comprehensive "social networking" application in just 30 hours. </p><p> Team Etat de Gen&#232;ve / Optaros was declared winner of the Perl track. The Geneva solution, based on <code>Catalyst</code> and <code>DBIx::DataModel</code>, was especially praised for its compactness. However, other Perl solutions by "plusW" (Germany) and "Revolution Systems" (USA) were very close, and it was hard for the jury to decide. The report notes that compactness and extensibility are consistent qualities of the Perl solutions. </p><p> For the Geneva team, that was a really instructive experience. It confirmed that we work with the right technology and skills<nobr> <wbr></nobr>... but also showed that we still have some progress to make as a team in the priorization and quality insurance processes! </p><p> See <a href="http://www.plat-forms.org/">http://www.plat-forms.org/</a> for the complete report and for many interesting observations on these 3 development platforms. A detailed report of what happened in Geneva team is published on <a href="http://www.plat-forms.org/2007/blog/archive/2007/01/29/journal-of-team1">http://www.plat-forms.org/2007/blog/archive/2007/01/29/journal-of-team1</a> </p> dami 2007-06-20T09:22:02+00:00 journal Web programming : not an exact science http://use.perl.org/~dami/journal/33379?from=rss Thanks to R&#233;mi Pauchet who pointed me in RT bug <a href="http://rt.cpan.org/Ticket/Display.html?id=27344">#27344</a> to the fact that Firefox rejects a CSS with header Content-type: text/css; charset=ascii. Remove the charset, and it works! Sounds totally silly to me, but so is life of Web programming<nobr> <wbr></nobr>... dami 2007-05-30T19:51:06+00:00 journal operators : defined-or, assign-or http://use.perl.org/~dami/journal/33328?from=rss I'm waiting eagerly for the "defined-or" operator in Perl 5.10<blockquote><div><p> <code> $val = expr1<nobr> <wbr></nobr>// expr2<nobr> <wbr></nobr>;<br> $val<nobr> <wbr></nobr>//= expr; </code></p></div> </blockquote><p> But I'm also missing something else : conditional assignment. I would love to be able to write something like</p><blockquote><div><p> <code> $some_hash{some_key} =? expr; </code></p></div> </blockquote><p> meaning</p><blockquote><div><p> <code> my $tmp;<br> $tmp = expr and $some_hash{some_key} = $tmp; </code></p></div> </blockquote><p> so put a new key in the hash only if the value is true. Right now I just write my code with <code>$tmp =<nobr> <wbr></nobr>... and<nobr> <wbr></nobr>..</code>, but that's ugly<nobr> <wbr></nobr>... any more clever idiom, anybody ?</p> dami 2007-05-22T09:53:54+00:00 journal Local AnnoCPAN http://use.perl.org/~dami/journal/33258?from=rss <p> Chris Dolan sent me a nice patch : inserting annotations from AnnoCPAN into the local Perl documentation displayed by Pod::POM::Web. It had never occured to me before that the AnnoCPAN database is available for download. </p><p> So now with Pod::POM::Web 1.05 you can grab <a href="http://annocpan.org/annopod.db">http://annocpan.org/annopod.db</a> and then browse annotated modules on your local machine. Nice ! </p> dami 2007-05-12T00:51:41+00:00 journal Pod::POM::Web published http://use.perl.org/~dami/journal/32666?from=rss Just published Pod::POM::Web on CPAN. This is a Web application for browsing and searching your local Perl documentation -- a kind of web perldoc, or a kind of Pod::Webserver, but with bells and whistles such as Ajax tree navigation, autocompletion, and fulltext indexing. I hope it can be a useful tool for Perl programmers. dami 2007-03-12T19:41:21+00:00 modules Plat-forms: journal of the Geneva team http://use.perl.org/~dami/journal/32273?from=rss The journal of what happened within the Geneva team during the plat-forms contest is published at <a href="http://www.plat-forms.org/2007/blog/archive/2007/01/29/journal-of-team1">http://www.plat-forms.org/2007/blog/archive/2007/01/29/journal-of-team1</a> dami 2007-01-29T17:11:27+00:00 journal Plat-forms: it's over http://use.perl.org/~dami/journal/32263?from=rss <p> Nice to be home, after a good night of sleep<nobr> <wbr></nobr>... but my head is still partly in Nuremberg, thinking of what went well (quite a lot of things), and what could have been better (a couple of lessons learned). I'll post about those thoughts a bit later<nobr> <wbr></nobr>... for the moment, I am trying to focus on the next thing to do, namely refreshing the voice and remembering all my texts for singing Rossini, Schubert and Spohr tonight. So I'm not yet over with stress ! </p><p> Platforms was a very nice experience, and the given task was quite interesting. For a while we thought we could do it all (over-ambitious as usual!)<nobr> <wbr></nobr>... but then a couple of unexpected problems rose and we lost too much time to finish properly : how frustrating ! </p><p> Thanks again to the organisers for the excellent preparation. </p> dami 2007-01-27T10:50:20+00:00 journal Plat-forms: ready to start, met other Perl teams http://use.perl.org/~dami/journal/32245?from=rss <p> OK, so finally there we are in Nuremberg, ready for the development contest starting tomorrow. It took us quite a long time to get there because of the snow in Europe. </p><p> We met the other Perl teams : it will be a nice panel of technologies : </p><ul> <li> Revolution Systems (<a href="http://www.revsys.com/">http://www.revsys.com/</a>) are using their own framework "Gantry" (<a href="http://www.usegantry.org/">http://www.usegantry.org/</a>)</li><li>PlusW (<a href="http://www.plusw.de/">http://www.plusw.de/</a>) are using Mason and MasonX-WebApp (<a href="http://cpan.uwinnipeg.ca/dist/MasonX-WebApp">http://cpan.uwinnipeg.ca/dist/MasonX-WebApp</a>)</li><li>the Geneva team is using Catalyst and DBIx::DataModel</li></ul><p> we are all eager to hear what the theme will be!</p> dami 2007-01-24T18:01:00+00:00 journal Plat-forms web development contest starting tomorrow http://use.perl.org/~dami/journal/32237?from=rss Flying tomorrow to Nuremberg for the web development platform contest (<a href="http://www.plat-forms.org/">http://www.plat-forms.org/</a>). We have 30 hours for developing a web application from some requirements that we will receive at the beginning of the contest. <p> The organisers expected many platforms like Ruby on Rails,<nobr> <wbr></nobr>.Net, Python<nobr> <wbr></nobr>.... in the end, there will be only Java, PHP and Perl. For each platform, 3 teams are in the run. </p><p> We (the Geneva team) hope that this will be an obvious proof to the world that Perl is well alive<nobr> <wbr></nobr>... of course if we don't mess it up at the contest ! </p><p> For those who would like to follow what is happening, stay in tune at the blog <a href="http://www.plat-forms.org/2007/blog">http://www.plat-forms.org/2007/blog</a>.</p> dami 2007-01-23T13:57:36+00:00 others