Re: Distribution installer that defaults to Debian?
On Wed, Dec 22, 2010 at 12:31:56AM -1000, Joel Roth wrote:
> To integrate with cpan clients, it would help to have a reliable
> way to get the corresponding upstream version. Here are some
> samples:
>
> Package Debian version Probable CPAN version
> -----------------------------------------------------
> padre 0.76.ds1-1 0.76
> nama 1.064-6 1.064
> libdancer-perl 1.2000+dfsg-1 1.2000
>
> Any references? I could whip up a regex, of course...
Answering my own question:
# from Perl::Version
my $version_re = qr/ ( (?i: Revision: \s+ ) | v | )
( \d+ (?: [.] \d+)* )
( (?: _ \d+ )? ) /x;
sub cpan_version {
my $apt_version = shift;
my ($cpan_version) = $apt_version =~ /^($version_re)/;
$cpan_version
}
--
Joel Roth
Reply to: