Just learned about CPAN::Mini on the Perl Advent Calendar <URL:http://www.perladvent.org/>. What a _spiffy_ idea! Just sorta blows me away, I never thought of taking that particular slice.
But once I had the latest versions of everything in CPAN sitting nice and happy on my hard disk, I figured I had to index it, of course. Hence the attached script. I use rc(1) for my shell scripting and swish++ for my indexer, but the idea's simple enough to rewrite in whatever language appeals. -Bennett
#!/bin/rc
src=$home/archive/minicpan
tmp=/var/tmp/^`{basename $0}^.$pid
fn sigexit { rm -rf $tmp }
mkdir $tmp
for (f in `{find $src/authors/id -type f ! -name 'CHECKSUMS'}) {
mkdir $tmp/_unpack
switch($f) {
case *.tar.gz
modname=`{basename $f .tar.gz}
@{cd $tmp/_unpack&&tar xzf $f}
case *.tgz
modname=`{basename $f .tgz}
@{cd $tmp/_unpack&&tar xzf $f}
case *.zip
modname=`{basename $f .zip}
@{cd $tmp/_unpack&&unzip $f}
case *.pm.gz
modname=`{basename $f .pm.gz}
@cd $tmp/_unpack&&gzip -d <$f >`{basename $src .gz}
}
{
find $tmp/_unpack -name README | xargs cat
find $tmp/_unpack -type f|xargs grep -l '^=head1'|xargs -l pod2text
} >$tmp/$modname
rm -rf $tmp/_unpack
}
@{cd $tmp && ls|index -W100000 -I -}
mv $tmp/swish++.index $src/
pgpP8b0YUhOB5.pgp
Description: PGP signature
