YAPC::EU::2010 - Rewriting Documents Talk Approved

Damn, damn, damn, my last post was eight days ago. Not sure if this interval qualifies for Iron Man. Any way, I'll continue trying to keep this blog active.

Then, today I would like to talk a little about one of the two talks I submitted to YAPC::EU::2010, the one that got accepted (for now), about rewriting documents.

Perl regular expressions are powerful. I think we can't call them regular anymore, since Perl 5.6. But, hey, that's the name everybody uses, so let's keep using it.

Now, sometimes we do not want to perform just a substitution, but a sequence of transformations. And, in some cases, these transformations are inter-dependent. When you are in this situation, a rewriting system is very useful.

A rewriting system is not anything more than just a mechanism to perform a sequence of substitutions accordingly with the current text contents. They can be compared with rule-based programming. Instead of specifying the full process to get from a document A to a document B, you specify little steps that take some detail of the document and make it nearer our final goal.

I will not describe much more now, or nobody will listen me in Pisa (I think that will happen anyway, so...). Just adding that these rewriting approach are very easy to extend and to configure to your needs, with great flexibility. Examples will be provided. Curious? Just give a first look into Text::RewriteRules.

Leave a comment

About Alberto Simões

user-pic I blog about Perl. D'uh!