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!
.
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
This has been wrapped in an initial module MsOffice::Word::HTML::Writer. Still lacking tests and examples, but already functional. Improvement suggestions are welcome!
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
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.
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!
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
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
$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 =,
but that's ugly
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 !