Subject: | autoformat dies when mail => 1 and all content is in signature |
Text-Autoformat-1.13
perl, v5.8.4 built for i386-linux-thread-multi
Linux debian 2.4.27-2-686 #1 Thu Jan 20 11:10:41 JST 2005 i686 GNU/Linux
If @paras is empty when line 410 is reached then an invalid entry is created for $paras[0].
my $gap = $paras[0]->{empty} ? 0 : $args{gap};
then line 424
my $hlen = $para->{hanglen} || $para->{hang}->length;
fails with
Can't call method "length" on an undefined value at /usr/local/share/perl/5.8.4/Text/Autoformat.pm line 424.
The test case attached is a mail/newsgroup posting where only the article it being wrapped and the article consists of only a signature so should not be too common but the result is quite severe.
#!/usr/bin/perl -w
use strict;
use warnings;
use Text::Autoformat;
my $a = "--\nsig\n";
print $a . "\n\n";
$a = autoformat($a , {"mail"=>1});
print $a . "\n\n";