Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created April 24, 2015 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagolden/9f887be78d1ce3620e2e to your computer and use it in GitHub Desktop.
Save dagolden/9f887be78d1ce3620e2e to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use IO::Zlib;
my $CPAN = shift || "/srv/cpan";
say "Parsing 06perms...";
my $fh = IO::Zlib->new( "$CPAN/modules/06perms.txt.gz", "rb" );
my $inheader = 1;
my $perms = {};
while (<$fh>) {
if ($inheader) {
$inheader = 0 if not m/ \S /x;
next;
}
chomp;
my ( $module, $author, $perm ) = split m/\s* , \s*/x;
push @{$perms->{$module}{maint}}, $author;
if ( $perm eq 'f' || $perm eq 'm' ) {
if ( exists $perms->{$module}{auth} ) {
my $o_author = $perms->{$module}{auth};
my $o_perm = $perm eq 'f' ? 'm' : 'f';
if ( $o_author eq $author ) {
say "duplicate primary on $module (same ID: $author)"
}
elsif ( $perm = 'm' ) {
say "duplicate primary on $module (m:$author f:$o_author)"
}
else {
say "duplicate primary on $module (m:$o_author f:$author)"
}
$perms->{$module}{auth} = $perm eq 'f' ? $author : $o_author;
}
else {
$perms->{$module}{auth} = $author;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment