CC: | bug-Text-Autoformat [...] rt.cpan.org |
Subject: | Text-Autoformat: Proposed new feature to 'ignore' and 'mail' params. |
Date: | Thu, 27 May 2010 10:38:48 -0400 (EDT) |
To: | damian [...] conway.org |
From: | Dan Wright <wright [...] pair.com> |
Hi,
I've started using Text::Autoformat in one of my projects at work, and
I'm enjoying the module. I've noticed a few quirks regarding the 'mail'
& 'ignore' parameters and I'd like to suggest an improvement:
First, even though the docs don't say so, it is currently impossible to
use both the 'mail' and 'ignore' parameters together. Any use of
'ignore' currently overrides 'mail'.
Additionally, it is a little frustrating that currently you can only
ignore one thing without constructing your own code-ref. And, there
seems to be no way to ignore 'indented' in addition to something else.
Finally, a rather minor point: The docs mention that 'mail' implies
all, but do not mention that 'ignore' also implies all.
My proposal is that autoformat be allowed to ignore more than one thing
at a time. I suggest that the ignore parameter accept an array-ref of
ignores, and that the 'mail' and 'ignore' parameters should not be
mutually exclusive. It would allow for the following syntax:
$tidy = autoformat $messy,
{ ignore => [ 'indented', qr/one/, qr/two/ ],
mail => 1 };
The only case where this change would not be backwards compatible would
be instances where users are currently using both 'mail' and 'ignore'
right now. But, I think if anybody is doing that, they probably are
unaware that currently their mail headers are all jumbled up. So, this
fix probably puts them closer to what they were expecting.
I've attached a proposed diff and regression tests.
Thanks and best regards,
-Dan
Daniel J. Wright wright@pair.com
Lead Software Developer, pairNIC https://www.pairnic.com
pair Networks, Inc. http://www.pair.com
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.