Mercurial > hg > lukkari
annotate parselist.pl @ 193:16ce445c499a v3 tip
Import v3 branch.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 22 Jan 2017 02:31:10 +0200 |
parents | 5f3ec534daa7 |
children |
rev | line source |
---|---|
160
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 #!/usr/bin/perl -w |
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 use strict; |
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 use warnings; |
179 | 4 use File::Slurp; |
160
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 |
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 my $patprefix = shift or die("Usage: $0 <prefix> <suffix>\n"); |
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 my $patsuffix = shift or die("Usage: $0 <prefix> <suffix>\n"); |
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 |
179 | 9 my %classes = (); |
10 my $data = read_file(\*STDIN); | |
11 if (defined($data)) | |
160
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 { |
179 | 13 $classes{$1} = 1 while ($data =~ /<a href="$patprefix([A-Z]{3}\d\S+)$patsuffix">/ig) |
14 } | |
160
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 |
179 | 16 |
17 foreach my $class (sort { $a cmp $b } keys %classes) | |
18 { | |
19 print $class."\n"; | |
160
a84b40bc2a99
Add parselist.pl utility and use it in update script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 } |
179 | 21 |
22 print STDERR "* Parsed classfile: ".scalar(keys %classes)."\n"; |