2010-02-19T20:37:27+01:00

When command line is too short :-)

perl -MDebian::Apt::PM -MList::MoreUtils=uniq -MYAML -MApp::Cache -MCPAN -le '$a=shift @ARGV or die; $p=Debian::Apt::PM->new(); $c=App::Cache->new(); do { local *STDOUT; $r = join "\n", grep { not $p->find($_) } grep { CPAN::Shell->expand("Module", $_) } uniq map { s/-/::/g; $_ } map { $_->{"name"} } map { eval { Load($_) } || {} } map { $c->get_url("http://archive.cpan.cz/authors/id/".substr($a,0,1)."/".substr($a,0,2)."/$a/$_") } map { map { $_ =~ /\.meta$/ ? $_ : () } @{$_} } CPAN::Shell->expand("Author", $a)->ls;}; print $r;' GAAS

A little more readable version:

use Debian::Apt::PM;
use List::MoreUtils 'uniq';
use YAML;
use App::Cache;
use CPAN;

$a=shift @ARGV or die;
$p=Debian::Apt::PM->new();
$c=App::Cache->new();

do {
	local *STDOUT;
	$r =
		join "\n",
		grep { not $p->find($_) }
		grep { CPAN::Shell->expand("Module", $_) }
		uniq
		map { s/-/::/g; $_ }
		map { $_->{"name"} }
		map { eval { Load($_) } || {} }
		map { $c->get_url("http://archive.cpan.cz/authors/id/".substr($a,0,1)."/".substr($a,0,2)."/$a/$_") }
		map { map { $_ =~ /\.meta$/ ? $_ : ()  } @{$_} }
		CPAN::Shell->expand("Author", $a)->ls
	;
};

print $r;

It prints out CPAN modules from author id that are not packaged in Debian. Will work for 99% of cases. Only problem are the distributions that have "custom" names, like libwww-perl, as the package name is created from the distribution name that is read from .meta files.