3 # This program generates the list of registered CPAN sites in perlmodlib.PL
11 my $http = HTTP::Tiny->new;
13 my $url = 'http://www.cpan.org/SITES';
14 my $filename = 'SITES';
15 my $response = $http->mirror( $url, $filename );
16 unless ( $response->{success} ) {
17 die "Error downloading $url";
20 my $fh = IO::File->new($filename);
22 while ( my $line = <$fh> ) {
26 '[Africa] [Asia] [Australasia] [Central America] [Europe] [North America] [South America]';
31 say 'Registered CPAN sites';
33 say '=for maintainers';
34 say 'Generated by Porting/make_modlib_cpan.pl';
41 while ( my $line = <$fh> ) {
43 next if $line =~ /^\s+$/;
44 last if $line eq 'Feedback';
46 if ( $line =~ /^(?<continent>\w.+)$/ ) {
53 if ( $continent eq 'North America' ) {
58 $continent = $+{continent};
60 say "=head2 $continent";
64 } elsif ( $line =~ /^\s{3}(?<country>\w.+)$/ ) {
68 $country = $+{country};
72 if ( $country eq 'United States' ) {
76 } elsif ( $line =~ /^\s{5}(?<state>\w.+)$/ ) {
83 } elsif ( $line =~ /^\s{22}(?<site>\w.+$)/ ) {
86 die "Unknown line: $line";