From bc71c9351eff77549de5256376a6b3e5a53bf3e5 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Wed, 13 Jan 2021 18:51:53 +0100 Subject: [PATCH] 'tinyproxy.pm' now emulates the 'to_literal_list' method to keep backwards compatibility with older versions of Perl-XML-LibXML --- lib/tinyproxy.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/tinyproxy.pm b/lib/tinyproxy.pm index 9873b85..1f5cb61 100644 --- a/lib/tinyproxy.pm +++ b/lib/tinyproxy.pm @@ -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@@@g; + push(@stats, $node); + } my %hstats = @stats; for my $key (keys %hstats) {