/[mws]/trunk/search.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/search.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 52 - (show annotations)
Tue May 25 18:55:46 2004 UTC (19 years, 10 months ago) by dpavlin
File MIME type: text/plain
File size: 916 byte(s)
move perl modules into lib directory, extracted HTTP daemon into new module
HTTP::Daemon::Simple

1 #!/usr/bin/perl -w
2
3 BEGIN {
4 my $basedir = readlink($0) || $0; $basedir =~ s#/[^/]+$#lib#;
5 unshift(@INC, $basedir);
6 }
7
8 =head1 NAME
9
10 search.pl - command-line search utility
11
12 =head1 SYNOPSYS
13
14 search.pl [local.conf] 'subject:nice demo'
15
16 =head1 DESCRIPTION
17
18 This utility is useful mainly for debugging, but you can try quick-searches
19 using it.
20
21 =cut
22
23 use Data::Dumper;
24 use MWS::SWISH;
25 use Template;
26
27 my $debug = 1;
28
29 my $s = shift @ARGV;
30
31 my $config_file = 'global.conf';
32 if (-f $s) {
33 $config_file = $s;
34 # print STDERR "using $config_file\n";
35 $s = '';
36 }
37
38 my $mws = MWS::SWISH->new(config_file=>$config_file);
39
40 $s.=join(" ",@ARGV);
41
42 my $results = $mws->search($s);
43 print "$results results...\n";
44
45 my $t = Template->new({
46 INCLUDE_PATH => $mws->{config}->val('global', 'templates'),
47 });
48
49 my @res = $mws->fetch_all_results();
50
51 $t->process("results.txt", {
52 query => $s,
53 results => \@res,
54 }) || die $t->error();
55

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26