/[swish]/trunk/spider/progspider
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/spider/progspider

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50 - (show annotations)
Tue Jan 20 18:13:32 2004 UTC (20 years, 3 months ago) by dpavlin
File size: 814 byte(s)
support for 0-size files

1 #!/usr/local/bin/perl -w
2 use strict;
3 use File::Find;
4
5
6 my $dir = shift @ARGV || die "usage: $0 [dir]";
7
8 my $basedir = $0;
9 $basedir =~ s,/[^/]+$,/,;
10 require "$basedir/filter.pm";
11
12 find({ wanted => \&file,
13 follow => 1,
14 no_chdir => 1
15 }, $dir);
16
17 sub file {
18
19 return if (! -f || ! m/\.html*/i);
20
21 my $path = $_;
22
23 open(F,"$path") || die "can't open file: $path";
24 # print STDERR "$path\n";
25 my $contents;
26 while(<F>) {
27 $contents .= $_;
28 }
29
30 $contents = filter($contents);
31
32 # die "zero size content in '$path'" if (! $contents);
33 return if (! $contents); # don't die on empty files
34
35 my $mtime = time;
36 my $size = length $contents;
37
38 # print STDERR " [$size]\n";
39
40 # Output the document (to swish)
41 print <<EOF;
42 Path-Name: $path
43 Content-Length: $size
44 Last-Mtime: $mtime
45 Document-Type: HTML
46
47 EOF
48
49 print $contents;
50
51 }

Properties

Name Value
cvs2svn:cvs-rev 1.3
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26