8 use OpenSSL::Query::REST;
15 'email|e', # Show email
16 'locale|l', # Show locale
17 'pgp|p', # Show PGP key ID
18 'activity|a', # Show whether person is active
19 'title|t=s', # Title of the resulting table
24 pod2usage(1) unless $options{title};
26 unless ($options{name} || $options{email} || $options{locale}
27 || $options{activity} || $options{pgp});
28 pod2usage(1) if $options{help};
29 pod2usage(-exitval => 0, -verbose => 2) if $options{man};
31 my $query = OpenSSL::Query->new();
33 my %data = (); # Indexed by name, value is a hash table of vals
34 foreach my $groupname (@ARGV) {
35 my @members = $query->members_of($groupname);
36 foreach my $ids (@members) {
37 my $name = (grep m|\s|, @$ids)[0];
38 my $email = (grep m|\@openssl\.org$|, @$ids)[0];
39 my $locale = $query->find_person_tag($email, 'country');
40 my $pgpid = $query->find_person_tag($email, 'pgp');
41 $data{$name} = { email => $email, locale => $locale, pgpid => $pgpid,
42 active => !!($groupname !~ m|-inactive$|),
43 emeritus => !!($groupname =~ m|-emeritus$|) };
48 push @columns, 'Name' if $options{name};
49 push @columns, 'Email' if $options{email};
50 push @columns, 'Locale' if $options{locale};
51 push @columns, 'PGP Key ID' if $options{pgp};
53 print "<table summary=\"$options{title}\">\n";
55 print join(" <th> </th>\n",
56 map { " <th>$_</th>\n" } @columns);
59 foreach my $key (sort { mk_sortable($a) cmp mk_sortable($b) } keys %data) {
60 my $pgpurl = $data{$key}->{pgpid} if $options{pgp};
61 $pgpurl =~ s|\s+||g if $pgpurl;
63 "http://pool.sks-keyservers.net:11371/pks/lookup?op=get&search=0x$pgpurl"
69 $data{$key}->{active} ? "" : "<i>",
70 encode_entities($key),
71 $data{$key}->{active} ? "" : "</i> (I)",
72 $data{$key}->{emeritus} ? " (OMC Emeritus)" : "")
75 "<a href='mailto:$data{$key}->{email}'>$data{$key}->{email}</a>"
77 push @columndata, $data{$key}->{locale} if $options{locale};
80 ? "<a href='$pgpurl'>$data{$key}->{pgpid}</a>" : ' '
84 print join(" <td> </td>\n",
85 map { " <td>$_</td>\n" } @columndata);
95 $name =~ s/(Dr|Mr|Mrs|Miss)\.?\s+//;
97 # Split into first+middle name and last names and flip them over with
99 # We work with the assumption that the middle name, if included, is
100 # given as a single letter followed by a possible period.
101 $name = ($name =~ m|^(\S+(?:\s\S\.?)?)\s+(.*)$|, "$2, $1");