Skip to content
Newer
Older
100644 42 lines (32 sloc) 981 Bytes
238fe9a Added various useful scripts to the bin directory
dave authored Jan 30, 2005
1 #!/usr/bin/perl -w
6fd6761 update the status.pl script to report about missing longitude and lat…
gabor authored Jul 21, 2010
2 use strict;
238fe9a Added various useful scripts to the bin directory
dave authored Jan 30, 2005
3 #
4 # Program to count perl monger groups by status.
5 #
6
7 $|++;
8
9 use XML::XPath;
10
11 my $xp = XML::XPath->new(filename => 'perl_mongers.xml')
12 || die 'badness!!';
13
14 my @nodes = $xp->findnodes('/perl_mongers/group');
15
16 my %counts;
17
6fd6761 update the status.pl script to report about missing longitude and lat…
gabor authored Jul 21, 2010
18 foreach my $node (@nodes) {
19 my $status = $node->findvalue('@status');
20 $counts{$status}++;
21 if ($status eq 'active') {
22 my $status = $node->findvalue('@status');
23 my $longitude = $node->findvalue('location/longitude/text()');
24 my $latitude = $node->findvalue('location/latitude/text()');
25 my $name = $node->findvalue('name/text()');
26 my $continent = $node->findvalue('location/continent/text()');
27 if ($continent) {
28 if (not $longitude) {
29 print "Longitude missing for $name\n";
30 } elsif (not $latitude) {
31 print "Latitude missing for $name\n";
32 }
33 }
34 }
238fe9a Added various useful scripts to the bin directory
dave authored Jan 30, 2005
35 }
36
37 my $tot;
38 print map { $tot += $counts{$_}; "$_ : $counts{$_}\n" } keys %counts;
39
40 print "\nTotal: $tot\n";
41
Something went wrong with that request. Please try again.