- LICENSE AND COPYRIGHT
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);
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...)
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 (
-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 rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dependencies-Searcher. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
<smonff at gmail.com>
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 http://dev.perl.org/licenses/ for more information.