Alien-SeleniumRC
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
sub perl_version_from {
my ( $self, $file ) = @_;
if (
$self->_slurp($file) =~ m/
^
use \s*
v?
([\d_\.]+)
\s* ;
/ixms
)
{
my $v = $1;
$v =~ s{_}{}g;
$self->perl_version($1);
}
else {
warn "Cannot determine perl version info from $file\n";
return;
}
}
sub author_from {
my ( $self, $file ) = @_;
my $content = $self->_slurp($file);
if ($content =~ m/
=head \d \s+ (?:authors?)\b \s*
([^\n]*)
|
=head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
.*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
([^\n]*)
/ixms) {
my $author = $1 || $2;
$author =~ s{E<lt>}{<}g;
$author =~ s{E<gt>}{>}g;
$self->author($author);
}
else {
warn "Cannot determine author info from $file\n";
}
}
sub license_from {
my ( $self, $file ) = @_;
if (
$self->_slurp($file) =~ m/
=head \d \s+
(?:licen[cs]e|licensing|copyright|legal)\b
(.*?)
(=head\\d.*|=cut.*|)
\z
/ixms
)
{
my $license_text = $1;
my @phrases = (
'under the same (?:terms|license) as perl itself' => 'perl',
'GNU public license' => 'gpl',
'GNU lesser public license' => 'gpl',
'BSD license' => 'bsd',
'Artistic license' => 'artistic',
'GPL' => 'gpl',
'LGPL' => 'lgpl',
'BSD' => 'bsd',
'Artistic' => 'artistic',
);
while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
$self->license($license);
return 1;
}
}
}
warn "Cannot determine license info from $file\n";
return 'unknown';
}
1;
( run in 0.604 second using v1.01-cache-2.11-cpan-411bb0df24b )