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 ]

bschoate (202)

  (email not shown publicly)

Journal of bschoate (202)

Thursday September 06, 2001
01:26 PM

wrap this

[ #769 ]

I just spent two hours tracking down a bug in a program where some text comes in with two spaces at one point in a paragraph and leaves (via email) with what appeared to be 7.

As it turns out, the text is being formatted using the Text::Wrap package, an excellent little module for wrapping a paragraph of text at a particular column.

What I didn't know was that the wrap() function uses routines in Text::Tabs to optimize whitespace, replacing them with tabs where it can.

That's just great, but why isn't this aspect of wrap() documented in the POD documentation? There is no mention of its use of Text::Tabs at all!

In order to work around this, I had to set $Text::Tabs::tabstop to some high magic number to keep it from altering my whitespace like that.


NB: I contacted Text::Wrap author David Muir Sharnoff and he tells me that the next release of Text::Wrap will document this 'feature'.

Thanks, David. It never hurts to ask.

Thursday August 23, 2001
09:28 AM


[ #695 ]

I put together a little templating processor yesterday. It uses HTML::TokeParser (once again, thanks CPAN!) to do the dirty work. Currently, it supports in-line scripting, includes and if/else testing. The syntax is XML-oriented and even uses a namespace so it can coexist in XHTML files easily. I like it.

It didn't take very long to write-- the main function is about 75 lines long.

I love Perl.