Added some hexadecimal display capabilities to aclox ascii clock
[mirrors/Programs.git] / perl / index / index.pl
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use File::Find;
5 use URI::Escape;
6
7 my $index_dir = './index';
8 my $docus_dir = './docs';
9
10 unlink <$index_dir/*>;
11 find({ wanted => \&index_file, no_chdir=>1 }, $docus_dir);
12
13 sub index_file() {
14 print $File::Find::name."\n";
15 open(my $fh, '<', $File::Find::name) or die $!;
16 while(<$fh>) {
17 $_ =~ s/\<[^\<]+\>//g; #strip tags
18 $_ = lc($_);
19
20 foreach(split(/[\s]/,$_)) {
21 $_ =~ /^\s+|\s+$/g; #trim
22 if($_ eq '') { next; }
23
24 print "$_\n";
25 $_ = uri_escape($_);
26 $_ = $index_dir.'/'.$_;
27
28 open(my $ifh, '>>', $_) or die $!;
29 print $ifh "$File::Find::name\n";
30 close($ifh);
31 }
32 }
33 close($fh);
34 }
This page took 0.875916 seconds and 4 git commands to generate.