beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 138 forks source link

Ack 2.12 standalone script on Win32 shows warning ...as a HASH ref while "strict refs" in use #436

Closed ghost closed 10 years ago

ghost commented 10 years ago

Your standalone script from http://beyondgrep.com/ack-2.12-single-file shows this warning with Strawberry Perl strawberry-perl-5.14.4.1-32bit (perl 5, version 14, subversion 4 (v5.14.4) built for MSWin32-x86-multi-thread) on Windows 7.

U:\>perl ack-2.12-single-file aaaaaaaa
Can't use string ("C:\ProgramData\ackrc") as a HASH ref while "strict refs" in use at ack-2.12-single-file line 4223.

Diff for a fix:

diff --git "a/ack-2.12-single-file" "b/ack-2.12-single-file_fixed"
index 88faa74..092654c 100644
--- "a/ack-2.12-single-file"
+++ "b/ack-2.12-single-file_fixed"
@@ -3408,7 +3408,7 @@ sub _remove_redundancies {
         my (%seen, @uniq);

         foreach my $path (map { $_->{path} } @configs) {
-            push @uniq, $path unless $seen{$path};
+            push @uniq, { path => $path } unless $seen{$path}; # fix on Windows for errormessage: Can't use string ("C:\ProgramData\ackrc") as a HASH ref while "strict refs" in use at ack-2.12-single-file line 4223.
             $seen{$path} = 1;
         }
petdance commented 10 years ago

This has been fixed on the dev branch and will be in 2.14. Unfortunately, I'm still getting build errors on 2.13_06. If you can help solve our build problems on 2.13_06 that would be a huge help.

jeremysimmons commented 10 years ago

thanks. this worked for me.

hoelzro commented 10 years ago

Seeing as this has been fixed, can we close this issue?