https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7208

Kevin A. McGrail <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
                   |                            |om

--- Comment #8 from Kevin A. McGrail <[email protected]> ---
> Do you have Geo::IP working?

I can recreate the issue, Thanks.  Adding the author to the bug.


Philipp,

Two wide version of perl to show the issue.

In perl 5.17.8, a simple perl -c of URILocalBL.pm passes.

Older perl such as 5.8.6, fails on perl -c with these errors:

Type of arg 1 to each must be hash (not hash element) at
/usr/local/lib/perl5/site_perl/5.8.6/Mail/SpamAssassin/Plugin/URILocalBL.pm
line 353, near "}) "
Type of arg 1 to keys must be hash (not hash element) at
/usr/local/lib/perl5/site_perl/5.8.6/Mail/SpamAssassin/Plugin/URILocalBL.pm
line 377, near "})"
Type of arg 1 to keys must be hash (not hash element) at
/usr/local/lib/perl5/site_perl/5.8.6/Mail/SpamAssassin/Plugin/URILocalBL.pm
line 406, near "})"
/usr/local/lib/perl5/site_perl/5.8.6/Mail/SpamAssassin/Plugin/URILocalBL.pm had
compilation errors.

Based on similar descriptions
(http://stackoverflow.com/questions/20824920/perl-array-references-and-avoiding-type-of-arg-1-to-keys-must-be-hash-error),
I think we need to typecast the hashrefs, i.e.

Index: lib/Mail/SpamAssassin/Plugin/URILocalBL.pm
===================================================================
--- lib/Mail/SpamAssassin/Plugin/URILocalBL.pm  (revision 1682254)
+++ lib/Mail/SpamAssassin/Plugin/URILocalBL.pm  (working copy)
@@ -350,7 +350,7 @@
     # look for W3 links only
     next unless (defined $info->{types}->{a});

-    while (my($host, $domain) = each $info->{hosts}) {
+    while (my($host, $domain) = each %{$info->{hosts}}) {

       # skip if the domain name was matched
       if (exists $rule->{exclusions} && exists $rule->{exclusions}->{$domain})
{
@@ -374,7 +374,7 @@
         }

         if (exists $rule->{countries}) {
-          dbg("check: uri_local_bl countries %s\n", join(' ', sort keys
$rule->{countries}));
+          dbg("check: uri_local_bl countries %s\n", join(' ', sort keys
%{$rule->{countries}}));

           my $cc = $self->{geoip}->country_code_by_addr($ip);

@@ -403,7 +403,7 @@
         }

         if (exists $rule->{isps}) {
-          dbg("check: uri_local_bl isps %s\n", join(' ', map { '"' . $_ . '"';
} sort keys $rule->{isps}));
+          dbg("check: uri_local_bl isps %s\n", join(' ', map { '"' . $_ . '"';
} sort keys %{$rule->{isps}}));

           my $isp = $self->{geoisp}->isp_by_name($ip);


Andrew, can you let me know if that works for you?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to