'tinyproxy.pm' now emulates the 'to_literal_list' method to keep backwards compatibility with older versions of Perl-XML-LibXML

This commit is contained in:
Jordi Sanfeliu 2021-01-13 18:51:53 +01:00
parent 5003c4da70
commit bc71c9351e
1 changed files with 12 additions and 1 deletions

View File

@ -177,7 +177,18 @@ sub tinyproxy_update {
my $xpath = '//tr//td';
my @stats;
push(@stats, $_) foreach $data->findnodes($xpath)->to_literal_list;
# This 'foreach' emulates the method 'to_literal_list' as it was
# introduced in Perl-XML-LibXML version 2.0105 (2013-09-07), and
# unfortunately not all systems have such a recent version.
#
# Some day in the future it should be changed by the line:
# push(@stats, $_) foreach $data->findnodes($xpath)->to_literal_list;
foreach($data->findnodes($xpath)->get_nodelist()) {
my $node;
($node = $_) =~ s@</?td>@@g;
push(@stats, $node);
}
my %hstats = @stats;
for my $key (keys %hstats) {