App-CPANtoRPM
view release on metacpan or search on metacpan
bin/cpantorpm-depreq view on Meta::CPAN
# Skip all the POD stuff. POD stuff SHOULD start with
# =pod, but most of the pod commands actually trigger the
# start of POD documentation.
$inpod=0, next if (/^=cut/);
$inpod=1, next if (/^=(pod|head[1-4]|over|item|back|begin|end|for|encoding)/);
next if ($inpod);
# The automatic RPM tools try to skip here documents and quoted
# strings. That would be nice... but they make too many assumptions
# about how the perl is written. There are way too many ways to
# specify these in a perl module, so I'm not going to do this. Once
# we've got a list of provides or requires, we'll need to manually
# filter out any bad ones.
# Skip everything after __DATA__ or __END__
last if (m/^__(DATA|END)__$/);
if ($OP eq 'prov') {
#
# Get the packages provided by this file.
#
# Lines of the form:
# package NAME;
# package NAME VERS;
# package NAME { ... };
# package NAME VERS { ... };
# (which may be split across lines)
if (/^\s*package/) {
my($pack,$ver);
while (1) {
if (/\A\s*package$seprx$modrx$seprx$verrx$endvrx/s) {
($pack,$ver) = ($1,$2);
last;
} elsif (/\A\s*package$seprx$modrx$endmrx/s) {
($pack,$ver) = ($1,'');
last;
} elsif (/\A\s*package$seprx?\z/s ||
/\A\s*package$seprx$modrx$seprx?\z/s) {
$_ .= <$in>;
next;
} else {
warn "Malformed package line\n";
next LINE;
}
}
$result{$pack} = $ver;
$package = $pack;
next LINE;
}
# Lines containing:
# $[NAME::]VERSION = VERS;
# or 'VERS', "VERS", q(VERS), qq(VERS)
# $[NAME::]VERSION = .* $Revision: VERS $
#
# Currently, we'll only support single-line defintions.
next LINE if (! $package);
my @m;
if (@m = (/\$(?:${package}::)?VERSION\s*=\s*$verqrx/s)) {
foreach my $m (@m) {
next if (! defined $m);
$result{$package} = $m;
next LINE;
}
next LINE;
}
} else {
#
# Get the modules required by this file.
#
# Lines of the form:
# require VERSION
# require MODULE
# use VERSION
# use MODULE
# use MODULE VERSION
# BEGIN { any_of_the_above .* }
# The standard tool ignores indented require statements as
# they are very often inside an 'if' statement and by including
# them, there are too many false positives. This might be worth
# adding.
my ($mod,$ver);
if (/^\s*$begrx(?:use)$seprx$modrx$seprx$verrx$endrx/s) {
($mod,$ver) = ($1,$2);
} elsif (/^\s*$begrx(?:use|require)$seprx$modrx$endrx/s) {
($mod,$ver) = ($1,0);
} elsif (/^\s*$begrx(?:use|require)$seprx$verrx$endrx/s) {
($mod,$ver) = ('',$1);
} else {
next LINE;
}
next LINE if ($mod eq 'vars' ||
$mod eq 'strict' ||
$mod eq 'integer' ||
$mod eq 'warnings' ||
$mod eq 'feature' ||
$mod eq 'constant' ||
$mod eq 'base' ||
$mod eq 'lib' ||
$mod eq 're' ||
$mod eq 'Config' ||
$mod eq 'Exporter'
);
( run in 1.871 second using v1.01-cache-2.11-cpan-364913b4093 )