Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

dami (6728)

dami
  (email not shown publicly)

Journal of dami (6728)

Saturday August 08, 2009
07:37 AM

Joining the Ironman challenge (finally)

After months of delaying the decision, I finally decided I had to join the Ironman planet and go blogging

.

The blog will not be on use.perl, but rather there.

Please stay in tune!

.

Wednesday January 07, 2009
11:05 PM

Server-side MsWord document generation

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.

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 ... and there it is, a document generated without MsOffice, but nevertheless with headers, footers, pagination, etc.

This has been wrapped in an initial module MsOffice::Word::HTML::Writer. Still lacking tests and examples, but already functional. Improvement suggestions are welcome!

Monday September 29, 2008
07:06 PM

ANNOUNCE: DBIx::DataModel 1.04

DBIx::DataModel v1.04 has been released to CPAN. This is
a major revision from previous v0.35, with several architectural
changes and added functionalities.

DBIx::DataModel is an Object-Relational mapping layer (ORM). Some of its
strong points are :

- UML-style declaration of relationships (instead of 'has_many',
    'belongs_to', etc.)

- efficiency through fine control of collaboration with the
    DBI layer (prepare/execute, fetch into reusable memory location, etc.)

- improved API for SQL::Abstract (named parameters, simplified 'orderBy')

- clear conceptual distinction between
        - data sources (tables and views),
        - database statements (stateful objects representing stepwise building
                                                        of an SQL query and stepwise retrieval of results),
        - data rows (lightweight hashrefs containing nothing but column
                                                        names and values)

- joins with simple syntax and possible override of default
    INNER JOIN/LEFT JOIN properties; instances of joins multiply
    inherit from their member tables

- named placeholders at the ORM level

- nested, cross-database transactions

The synopsis is in
http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel.pm;
the design principles and general architecture are explained
in http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel/Doc/Design.pod

Thursday June 19, 2008
03:26 PM

XS is fun

So far I had always looked at XS code as dark, unknown territory.

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).

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 !

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.

Wednesday February 27, 2008
02:23 PM

package in main file : careful with initializations!

A colleague of mine came with a program looking more or less like this. What do you think is the output ?

  use strict;
  use warnings;

  my $obj = Obj->new(11);
  print $obj->meth, "\n";

  #-----------
  package Obj;
  #-----------
  use strict;
  use warnings;

  my $foo = 22;
  my $bar = 33;

  sub new {
    my ($class, $arg) = @_;
    my $self = bless {arg => $arg}, $class;
  }

  sub meth {
    my ($self) = @_;
    return "$self->{arg} / $foo / $bar";
  }

It looks so obvious : the answer must be 11 / 22 / 33. But this is wrong! We get trapped by being so used to external packages, where everything is initialized at load time.

Here, everything is in the same file. So the main program starts, new and meth get called before $foo and $bar are initialized, and the result is 11 / / , with a warning about uninitialized values!

Wednesday June 20, 2007
04:22 AM

plat_forms report published June 20th, 2007

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 http://www.plat-forms.org/.

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.

Team Etat de Genève / Optaros was declared winner of the Perl track. The Geneva solution, based on Catalyst and DBIx::DataModel, 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.

For the Geneva team, that was a really instructive experience. It confirmed that we work with the right technology and skills ... but also showed that we still have some progress to make as a team in the priorization and quality insurance processes!

See http://www.plat-forms.org/ 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 http://www.plat-forms.org/2007/blog/archive/2007/01/29/journal-of-team1

Wednesday May 30, 2007
02:51 PM

Web programming : not an exact science

Thanks to Rémi Pauchet who pointed me in RT bug #27344 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 ...
Tuesday May 22, 2007
04:53 AM

operators : defined-or, assign-or

I'm waiting eagerly for the "defined-or" operator in Perl 5.10

$val = expr1 // expr2 ;
$val //= expr;

But I'm also missing something else : conditional assignment. I would love to be able to write something like

$some_hash{some_key} =? expr;

meaning

my $tmp;
$tmp = expr and $some_hash{some_key} = $tmp;

so put a new key in the hash only if the value is true. Right now I just write my code with $tmp = ... and .., but that's ugly ... any more clever idiom, anybody ?

Friday May 11, 2007
07:51 PM

Local AnnoCPAN

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.

So now with Pod::POM::Web 1.05 you can grab http://annocpan.org/annopod.db and then browse annotated modules on your local machine. Nice !

Monday March 12, 2007
02:41 PM

Pod::POM::Web published

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.