Dependencies::Searcher::AckRequester - Helps Dependencies::Searcher to use Ack


    my $requester = Dependencies::Searcher::AckRequester->new();

    # Places to search...
    my @path = ("./lib", "./Makefile.PL", "./script");

    # Params for Ack
    my @params = ('--perl', '-hi', $pattern, @path);

    # Absolute path to the Ack binary
    my $ack_path = $requester->get_path();

    # Build the command for IPC::Cmd
    my $cmd_use = $requester->build_cmd(@params);

    # Execute the command and retrieve the output
    my @moduls = $requester->ack($cmd_use);


This module use ack through a system command to search recursively for patterns. It use IPC::Cmd as a layer between the module and ack, that execute and retrieve the command output.

It also builds the command itself (path and arguments). Arguments are stored into an array, because it is too much dangerous to build a command with strings (space problems are one reason among others).

It's not made to be used independantly from Dependencies::Searcher (mean it's not supposed to be used directly into your programs, but you can try if you want...)



Returns the ack full path if installed. Set the full_path Moose attribute that will be used by ICP::Cmd. It verify also that Ack is reachable or warns about it.


build_cmd() takes as parameter all the arguments Ack will need. Dependencies::Searcher defines it like this :

  • --perl : tells to search in Perl like files (*.pm, *.pl, etc.)

  • -hi : suppress the prefixing filename on output + ignore case

  • $pattern : must be passed from your implementation

  • @path : files and directories where ack will go

    All these params are merged in an only array reference that is returned for later use with IPC::Cmd.


Execute the IPC::Cmd command that calls ack and returns an array of potentially interesting lines, containing dependencies names but some crap inside too.


Win32 and Cygwin platforms aren't well supported but last tests have not been that bad.


Please report any bugs or feature requests to bug-dependencies-searcher at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.



smonff, <smonff at>



Ack gives me the wish to try to write this module. It was pure Perl so I've choose it because it was possible to install it through CPAN during the distribution installation process. Even if Ack was not meant for being used programatically, this hacked use of Ack do the job.



Copyright 2013 smonff.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.