| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | ||
| 4 | if 0; | ||
| 5 | |||
| 6 | $VERSION = '0.01'; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | findacronym.pl - Search AcronymFinder.com | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | B<findacronym.pl> query [ function ] | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | A utility to search acronyms. It iterates through all the search functions if it is not specified. | ||
| 19 | |||
| 20 | =head1 SEE ALSO | ||
| 21 | |||
| 22 | L<WWW::Search>, L<WWW::Search::AcronymFinder> | ||
| 23 | |||
| 24 | =head1 AUTHORS | ||
| 25 | |||
| 26 | xern <xern@cpan.org> | ||
| 27 | |||
| 28 | =head1 LICENSE | ||
| 29 | |||
| 30 | Released under The Artistic License | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | |||
| 35 | $query = $ARGV[0] || die "$0 query function\n"; | ||
| 36 | $function = $ARGV[1]; | ||
| 37 | |||
| 38 | @funcarr = ('exact', 'prefix', 'reverse', 'wildcard'); | ||
| 39 | |||
| 40 | use WWW::Search::AcronymFinder; | ||
| 41 | |||
| 42 | $search = new WWW::Search('AcronymFinder'); | ||
| 43 | |||
| 44 | for ( $function ? $function : @funcarr ){ | ||
| 45 | $search->native_query(WWW::Search::escape_query($query), { function => $_ }); | ||
| 46 | print "-"x14, $_, "-"x14, $/; | ||
| 47 | while (my $result = $search->next_result()) { | ||
| 48 | print "$result\n"; | ||
| 49 | } | ||
| 50 | } |