The following code (adding the delete command in the eval call) works (no error message: "can't call method..."), but there is still a memory leak.
use warnings;
use strict;
use diagnostics;
use HTML::FormatText;
use HTML::TreeBuilder 5 - weak;
use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace };
use Test::More HAS_LEAKTRACE ? (tests => 1) : (skip_all => 'require Te
+st::LeakTrace');
use Test::LeakTrace;
leaks_cmp_ok{
open INPUT, "< D:/websiteadresses.txt" or die "Problem: $!";
# The file contains the adresses of 28 000 websites
my @INPUT=<INPUT>;
close INPUT;
while (@INPUT) {
my $input=shift(@INPUT);
#my $proposal;
chomp $input;
print $input;
my $content=HTML::FormatText->format_file($input, leftmargin => 0, ri
+ghtmargin => 50);
eval { $content->delete; };
# followed by regular expressions, the results of which are saved in
+a different file - all now disabled
}
} '<', 1;