Slash Boxes
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 ]

BooK (2612)

  {book} {at} {}
Yahoo! ID: philippe_bruhat (Add User, Send Message)

Obfuscation []. Pink []. HTTP::Proxy []. YEF []. Fishnet []. Kapow []. Cog's [] bitch []. Invitation []. White [] Camel []. Nuff' said.

Journal of BooK (2612)

Friday July 23, 2004
07:41 PM

Pod::POM and Perl::Tidy

[ #20028 ]

Thanks to Pod::POM and Perl::Tidy, all the Perl articles written by Les Mongueurs de Perl and published by GNU/Linux Magazine France now contain colored code examples.

The trickiest part was to prevent Perl::Tidy from choking on a verbatim, indented piece of code containing a here-document:

=begin tidy

    print << 'EOT';
    foo bar

=end tidy

The text string passed to Perl::Tidy has to be munged so that line 4 is 'EOT' and not '<SP><SP><SP><SP>EOT'.

This was achieved by writing =begin tidy EOT and having the view remove all blanks at the begining of the lines matching the heredoc boundary, stacking them in an array (in case several heredocs in the code snippet used the same string) and putting them back after. A rather clumsy solution.

Luckily, while writing this entry I thought to myself: "Mmm, maybe another option would have been too simply unindent the whole code based on the first line and reindent it after Perl::Tidy's finished working on it." It really sounds much better and general this way.

Anyway, just have a look all these colorful Perl articles!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.