#!/usr/bin/perl -w

$VERSION = '1.52';

=head1 NAME

fzindex - FuzzyIndex index utility

=head1 SYNOPSIS

    % fzindex index.db *.txt    # shell glob
    % fzindex index.db '*.txt'  # glob string

=head1 DESCRIPTION

Just run fzindex at command line. The first argument is the db file
to store index results, remaining arguments being glob patterns of
files to be indexed.

=cut

use OurNet::FuzzyIndex '1.52';
use strict;

local $/;

my $db = OurNet::FuzzyIndex->new(
    shift || die "Usage: $0 <indexfile> [files | filespec]\n"
);

foreach my $file (<@ARGV>) {
    next if $db->findkey($file);

    print "indexing $file...\n";

    open _, $file;
    $db->insert($file, <_> || '');
    close _;
}

1;

__END__

=head1 AUTHORS

Autrijus Tang E<lt>autrijus@autrijus.org>

=head1 COPYRIGHT

Copyright 2001 by Autrijus Tang E<lt>autrijus@autrijus.org>.

All rights reserved.  You can redistribute and/or modify
this module under the same terms as Perl itself.

=cut

