| 1 | package Perl::Metrics2::CpanFile; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Perl::Metrics2 (); | ||
| 5 | |||
| 6 | our $VERSION = '0.06'; | ||
| 7 | |||
| 8 | sub release_index { | ||
| 9 | my $dbh = Perl::Metrics2->dbh or return; | ||
| 10 | my $sth = $dbh->prepare('SELECT DISTINCT release FROM cpan_file', {}) or return; | ||
| 11 | $sth->execute or return; | ||
| 12 | my %hash = (); | ||
| 13 | my $value = undef; | ||
| 14 | $sth->bind_col(1, \$value) or return; | ||
| 15 | while ( $sth->fetch ) { | ||
| 16 | my $one = substr($_, 0, 1); | ||
| 17 | my $two = substr($_, 0, 2); | ||
| 18 | $hash{"$one/$two/$_"} = 1; | ||
| 19 | } | ||
| 20 | return \%hash; | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; |