How can I install and use ack library on Windows?

2019-03-07 18:26发布

I have never used Perl, but I am really impressed by the ack, which I would like to use for source code searching, etc.

Can anyone guide me of how to make use of this excellent library on Windows?

标签: windows perl ack
9条回答
姐就是有狂的资本
2楼-- · 2019-03-07 18:33

You can install ack via cpan:

install strawberry perl

run cmd as admin

install ack:

cpan> force install App::Ack

it should work from there, followed this guide: http://www.jeedo.net/how-to-install-ack-on-windows-10/

Worked without any hitches.

查看更多
男人必须洒脱
3楼-- · 2019-03-07 18:34

Start by installing perl http://strawberryperl.com/

Install App::Ack by typing (in a windows command shell)

C:\>cpan App::Ack

And undoubtedly this will prove useful http://learn.perl.org/

查看更多
ゆ 、 Hurt°
4楼-- · 2019-03-07 18:35

You should also run the following command to enable color highlights: cpan Win32::Console::ANSI

查看更多
戒情不戒烟
5楼-- · 2019-03-07 18:36

Not all the tests pass on all versions of Windows. You can most likely get 100% functionality from ack even if the install tests fail. Here is the command to force installation if failing tests prevent a normal install:

perl -MCPAN -e "CPAN::Shell->force(qw(install App::Ack));"
查看更多
放我归山
6楼-- · 2019-03-07 18:41

I had to force cpan to install App::Ack since some of the tests didn't pass:

C:\> cpan
cpan> force install App::Ack
cpan> q
查看更多
Explosion°爆炸
7楼-- · 2019-03-07 18:44

If you have cygwin installed, you can simply download the standalone version. Perl is installed with cygwin. Here are the steps:

$ vim .bash_profile

Remove the comments from the lines:

# if [ -d "${HOME}/bin" ] ; then
#  PATH="${HOME}/bin:${PATH}"
# fi

Load the changes:

$ source .bash_profile

Make a bin directory:

$ mkdir ~/bin

Download ack (from the homepage):

$ curl https://beyondgrep.com/ack-2.22-single-file > ~/bin/ack && chmod 0755 ~/bin/ack

Note: you will have to manually install curl as it doesn't come with cygwin by default.

查看更多
登录 后发表回答