NAME

App::Relate - simple form of the "relate" script (wrapper around locate)

SYNOPSIS

use App::Relate ':all';

relate( \@search, \@filter );

relate( \@search, \@filter, $opts );

DESCRIPTION

relate simplifies the use of locate.

Instead of:

locate this | egrep "with_this" | egrep "and_this" | egrep -v "but_not_this"

You can type:

relate this with_this and_this -but_not_this

This module is a simple back-end to implement the relate script. See relate for user documentation.

EXPORT

None by default. The following, on request (or via ':all' tag):

relate

Example usage:

my $results = relate( \@search_terms, \@filter_terms, $opts );

A more detailed example, searching a test data set:

my $skipdull = ['~$', '\bRCS\b', '\bCVS\b', '^#', '\.elc$' ];
my $results =
   relate( [ 'whun' ], $skipdull,
     { test_data => [ '/tmp/whun',
                      '/tmp/tew',
                      '/tmp/thruee',
                      '/etc/whun',
                  ],
       } );

If a "test_data" aref option has been supplied, it will search that listing rather than doing a locate command (this is for testing purposes).

Note that the options hash is passed through to the locate routine, so this routine also supports the "locate" and "database" options.

locate

Runs the locate command on the given search term, the "seed". Also accepts a hashref of options as a second argument.

Define the locate option to something besides 'locate' to run a different program (note: you may include the path here).

Example:

my $hits = locate( $seed, { locate => '/usr/local/bin/slocate' } );

SEE ALSO

See the man page for "locate".

App::Relate is a more complicated version of this project. It's based on List::Filter, which was intended to allow the sharing of filters between different projects.

NOTES

TODO

AUTHOR

Joseph Brenner, <doom@kzsu.stanford.edu>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Joseph Brenner

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.

BUGS

See relate.