| 1 |
NAME |
| 2 |
CPAN::DistnameInfo - Extract distribution name and version from a |
| 3 |
distribution filename |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
my $pathname = "authors/id/G/GB/GBARR/CPAN-DistnameInfo-0.02.tar.gz"; |
| 7 |
|
| 8 |
my $d = CPAN::DistnameInfo->new($pathname); |
| 9 |
|
| 10 |
my $dist = $d->dist; # "CPAN-DistnameInfo" |
| 11 |
my $version = $d->version; # "0.02" |
| 12 |
my $maturity = $d->maturity; # "released" |
| 13 |
my $filename = $d->filename; # "CPAN-DistnameInfo-0.02.tar.gz" |
| 14 |
my $cpanid = $d->cpanid; # "GBARR" |
| 15 |
my $distvname = $d->distvname; # "CPAN-DistnameInfo-0.02" |
| 16 |
|
| 17 |
my %prop = $d->properties; |
| 18 |
|
| 19 |
DESCRIPTION |
| 20 |
Many online services that are centered around CPAN attempt to associate |
| 21 |
multiple uploads by extracting a distribution name from the filename of |
| 22 |
the upload. For most distributions this is easy as they have used |
| 23 |
ExtUtils::MakeMaker or Module::Build to create the distribution, which |
| 24 |
results in a uniform name. But sadly not all uploads are created in this |
| 25 |
way. |
| 26 |
|
| 27 |
"CPAN::DistnameInfo" uses heuristics that have been learnt by |
| 28 |
<http://search.cpan.org/> to extract the distribution name and version |
| 29 |
from filenames and also report if the version is to be treated as a |
| 30 |
developer release |
| 31 |
|
| 32 |
The constructor takes a single pathname, returning an object with the |
| 33 |
following methods |
| 34 |
|
| 35 |
cpanid |
| 36 |
If the path given looked like a CPAN authors directory path, then |
| 37 |
this will be the the CPAN id of the author. |
| 38 |
|
| 39 |
dist |
| 40 |
The name of the distribution |
| 41 |
|
| 42 |
distvname |
| 43 |
The file name with any suffix and leading directory names removed |
| 44 |
|
| 45 |
filename |
| 46 |
If the path given looked like a CPAN authors directory path, then |
| 47 |
this will be the path to the file relative to the detected CPAN |
| 48 |
author directory. Otherwise it is the path that was passed in. |
| 49 |
|
| 50 |
maturity |
| 51 |
The maturity of the distribution. This will be either "released" or |
| 52 |
"developer" |
| 53 |
|
| 54 |
properties |
| 55 |
This will return a list of key-value pairs, suitable for assigning |
| 56 |
to a hash, for the known properties. |
| 57 |
|
| 58 |
version |
| 59 |
The extracted version |
| 60 |
|
| 61 |
AUTHOR |
| 62 |
Graham Barr <[email protected]> |
| 63 |
|
| 64 |
COPYRIGHT |
| 65 |
Copyright (c) 2003 Graham Barr. All rights reserved. This program is |
| 66 |
free software; you can redistribute it and/or modify it under the same |
| 67 |
terms as Perl itself. |
| 68 |
|