0001
0002
0003 my %include = ();
0004 my %included = ();
0005
0006 for my $text (<*.txt>) {
0007 open I, '<', $text || die "cannot read: $text";
0008 while (<I>) {
0009 if (/^include::/) {
0010 chomp;
0011 s/^include::\s*//;
0012 s/\[\]//;
0013 $include{$text}{$_} = 1;
0014 $included{$_} = 1;
0015 }
0016 }
0017 close I;
0018 }
0019
0020
0021 my $changed = 1;
0022 while ($changed) {
0023 $changed = 0;
0024 while (my ($text, $included) = each %include) {
0025 for my $i (keys %$included) {
0026
0027
0028 if (exists $include{$i}) {
0029 for my $j (keys %{$include{$i}}) {
0030 if (!exists $include{$text}{$j}) {
0031 $include{$text}{$j} = 1;
0032 $included{$j} = 1;
0033 $changed = 1;
0034 }
0035 }
0036 }
0037 }
0038 }
0039 }
0040
0041 while (my ($text, $included) = each %include) {
0042 if (! exists $included{$text} &&
0043 (my $base = $text) =~ s/\.txt$//) {
0044 print "$base.html $base.xml : ", join(" ", keys %$included), "\n";
0045 }
0046 }