30 lines
518 B
Perl
Executable file
30 lines
518 B
Perl
Executable file
package Dist;
|
|
use strict;
|
|
use warnings;
|
|
use Data::Dumper;
|
|
|
|
our %dist_to_mod;
|
|
our %mod_to_dist;
|
|
|
|
open(my $fh, "<", "02packages.details.txt");
|
|
|
|
while (my $l = <$fh>) {
|
|
chomp $l;
|
|
my ($module, $version, $dist) = split(' ', $l,3);
|
|
|
|
push $dist_to_mod{$dist}->@*, $module;
|
|
$mod_to_dist{$module} = $dist;
|
|
}
|
|
|
|
sub get_author {
|
|
my $module = shift; # dist name or module name
|
|
|
|
if (my $dist = $mod_to_dist{$module}) {
|
|
if ($dist =~ m|^\w/\w\w/([^/]+)/[^/]+$|) {
|
|
return $1;
|
|
}
|
|
}
|
|
|
|
return '';
|
|
}
|
|
1;
|