view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Perl versions (eg, 5.8.1).
sub _version ($) {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
# Normalise multipart versions
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map {
$_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
sub _cmp ($$) {
_version($_[1]) <=> _version($_[2]);
}
inc/Module/Install/AuthorTests.pm view on Meta::CPAN
my @tests = $self->tests ? (split / /, $self->tests) : 't/*.t';
# XXX: pick a default, later -- rjbs, 2008-02-24
my @dirs = @$dirs ? @$dirs : Carp::confess "no dirs given to author_tests";
@dirs = grep { -d } @dirs;
if ($recurse) {
require File::Find;
my %test_dir;
File::Find::find(_wanted(\%test_dir), @dirs);
$self->tests( join ' ', @tests, map { "$_/*.t" } sort keys %test_dir );
} else {
$self->tests( join ' ', @tests, map { "$_/*.t" } sort @dirs );
}
}
#line 107
1;
inc/Module/Install/Makefile.pm view on Meta::CPAN
sub _wanted_t {
}
sub tests_recursive {
my $self = shift;
my $dir = shift || 't';
unless ( -d $dir ) {
die "tests_recursive dir '$dir' does not exist";
}
my %tests = map { $_ => 1 } split / /, ($self->tests || '');
require File::Find;
File::Find::find(
sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 },
$dir
);
$self->tests( join ' ', sort keys %tests );
}
sub write {
my $self = shift;
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @tests = split ' ', $self->tests;
my %seen;
$args->{test} = {
TESTS => (join ' ', grep {!$seen{$_}++} @tests),
};
} elsif ( $Module::Install::ExtraTests::use_extratests ) {
# Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness.
# So, just ignore our xt tests here.
} elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) {
$args->{test} = {
TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ),
};
}
if ( $] >= 5.005 ) {
$args->{ABSTRACT} = $self->abstract;
$args->{AUTHOR} = join ', ', @{$self->author || []};
}
if ( $self->makemaker(6.10) ) {
$args->{NO_META} = 1;
#$args->{NO_MYMETA} = 1;
}
inc/Module/Install/Makefile.pm view on Meta::CPAN
}
unless ( $self->is_admin ) {
delete $args->{SIGN};
}
if ( $self->makemaker(6.31) and $self->license ) {
$args->{LICENSE} = $self->license;
}
my $prereq = ($args->{PREREQ_PM} ||= {});
%$prereq = ( %$prereq,
map { @$_ } # flatten [module => version]
map { @$_ }
grep $_,
($self->requires)
);
# Remove any reference to perl, PREREQ_PM doesn't support it
delete $args->{PREREQ_PM}->{perl};
# Merge both kinds of requires into BUILD_REQUIRES
my $build_prereq = ($args->{BUILD_REQUIRES} ||= {});
%$build_prereq = ( %$build_prereq,
map { @$_ } # flatten [module => version]
map { @$_ }
grep $_,
($self->configure_requires, $self->build_requires)
);
# Remove any reference to perl, BUILD_REQUIRES doesn't support it
delete $args->{BUILD_REQUIRES}->{perl};
# Delete bundled dists from prereq_pm, add it to Makefile DIR
my $subdirs = ($args->{DIR} || []);
if ($self->bundles) {
inc/Module/Install/Makefile.pm view on Meta::CPAN
if ( $self->makemaker(6.48) ) {
$args->{MIN_PERL_VERSION} = $perl_version;
}
}
if ($self->installdirs) {
warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS};
$args->{INSTALLDIRS} = $self->installdirs;
}
my %args = map {
( $_ => $args->{$_} ) } grep {defined($args->{$_} )
} keys %$args;
my $user_preop = delete $args{dist}->{PREOP};
if ( my $preop = $self->admin->preop($user_preop) ) {
foreach my $key ( keys %$preop ) {
$args{dist}->{$key} = $preop->{$key};
}
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
push @{$self->{values}->{$key}}, @_;
return $self;
};
}
foreach my $key ( @resource_keys ) {
*$key = sub {
my $self = shift;
unless ( @_ ) {
return () unless $self->{values}->{resources};
return map { $_->[1] }
grep { $_->[0] eq $key }
@{ $self->{values}->{resources} };
}
return $self->{values}->{resources}->{$key} unless @_;
my $uri = shift or die(
"Did not provide a value to $key()"
);
$self->resources( $key => $uri );
return 1;
};
inc/Module/Install/Metadata.pm view on Meta::CPAN
*$key = sub {
my $self = shift;
return $self->{values}->{$key} unless @_;
my @added;
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
push @added, [ $module, $version ];
}
push @{ $self->{values}->{$key} }, @added;
return map {@$_} @added;
};
}
# Resource handling
my %lc_resource = map { $_ => 1 } qw{
homepage
license
bugtracker
repository
};
sub resources {
my $self = shift;
while ( @_ ) {
my $name = shift or last;
inc/Module/Install/Metadata.pm view on Meta::CPAN
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
my $count = 0;
push @$features, (
$name => [
map {
ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_
} @$mods
]
);
return @$features;
}
sub features {
my $self = shift;
inc/Module/Install/Metadata.pm view on Meta::CPAN
([^\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;
# XXX: ugly but should work anyway...
if (eval "require Pod::Escapes; 1") {
# Pod::Escapes has a mapping table.
# It's in core of perl >= 5.9.3, and should be installed
# as one of the Pod::Simple's prereqs, which is a prereq
# of Pod::Text 3.x (see also below).
$author =~ s{ E<( (\d+) | ([A-Za-z]+) )> }
{
defined $2
? chr($2)
: defined $Pod::Escapes::Name2character_number{$1}
? chr($Pod::Escapes::Name2character_number{$1})
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) {
# Pod::Text < 3.0 has yet another mapping table,
# though the table name of 2.x and 1.x are different.
# (1.x is in core of Perl < 5.6, 2.x is in core of
# Perl < 5.9.3)
my $mapping = ($Pod::Text::VERSION < 2)
? \%Pod::Text::HTML_Escapes
: \%Pod::Text::ESCAPES;
$author =~ s{ E<( (\d+) | ([A-Za-z]+) )> }
{
defined $2
? chr($2)
: defined $mapping->{$1}
? $mapping->{$1}
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
else {
$author =~ s{E<lt>}{<}g;
$author =~ s{E<gt>}{>}g;
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
# Load the advisory META.yml file
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
# Overwrite the non-configure dependency hashs
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
if ( exists $val->{requires} ) {
$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
}
if ( exists $val->{build_requires} ) {
$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
}
return $meta;
}
1;
inc/Module/Install/XSUtil.pm view on Meta::CPAN
for my $dir(@dirs){
unless(-d $dir){
warn("'$dir' not found: $!\n");
}
_verbose "inc: -I$dir" if _VERBOSE;
}
my $mm = $self->makemaker_args;
my $paths = join q{ }, map{ s{\\}{\\\\}g; qq{"-I$_"} } @dirs;
if($mm->{INC}){
$mm->{INC} .= q{ } . $paths;
}
else{
$mm->{INC} = $paths;
}
return;
}
sub cc_libs {
my ($self, @libs) = @_;
@libs = map{
my($name, $dir) = ref($_) eq 'ARRAY' ? @{$_} : ($_, undef);
my $lib;
if(defined $dir) {
$lib = ($dir =~ /^-/ ? qq{$dir } : qq{-L$dir });
}
else {
$lib = '';
}
$lib .= ($name =~ /^-/ ? qq{$name} : qq{-l$name});
_verbose "libs: $lib" if _VERBOSE;
inc/Module/Install/XSUtil.pm view on Meta::CPAN
_verbose "xs: $src_file" if _VERBOSE;
}
else{
_verbose "c: $c" if _VERBOSE;
}
push @{$C_ref}, $c unless grep{ $_ eq $c } @{$C_ref};
}
$self->clean_files(map{
File::Spec->catfile($_, '*.gcov'),
File::Spec->catfile($_, '*.gcda'),
File::Spec->catfile($_, '*.gcno'),
} @dirs);
$self->cc_append_to_inc('.');
return;
}
sub cc_include_paths{
my($self, @dirs) = @_;
$self->_xs_initialize();
push @{ $self->{xsu_include_paths} ||= []}, @dirs;
my $h_map = $self->{xsu_header_map} ||= {};
foreach my $dir(@dirs){
my $prefix = quotemeta( File::Spec->catfile($dir, '') );
find(sub{
return unless / \.h(?:pp)? \z/xms;
(my $h_file = $File::Find::name) =~ s/ \A $prefix //xms;
$h_map->{$h_file} = $File::Find::name;
}, $dir);
}
$self->cc_append_to_inc(@dirs);
return;
}
sub install_headers{
my $self = shift;
my $h_files;
if(@_ == 0){
$h_files = $self->{xsu_header_map} or die "install_headers: cc_include_paths not specified.\n";
}
elsif(@_ == 1 && ref($_[0]) eq 'HASH'){
$h_files = $_[0];
}
else{
$h_files = +{ map{ $_ => undef } @_ };
}
$self->_xs_initialize();
my @not_found;
my $h_map = $self->{xsu_header_map} || {};
while(my($ident, $path) = each %{$h_files}){
$path ||= $h_map->{$ident} || File::Spec->join('.', $ident);
$path = File::Spec->canonpath($path);
unless($path && -e $path){
push @not_found, $ident;
next;
}
$ToInstall{$path} = File::Spec->join('$(INST_ARCHAUTODIR)', $ident);
_verbose "install: $path as $ident" if _VERBOSE;
inc/Module/Install/XSUtil.pm view on Meta::CPAN
my $cppflags = q{"-I}. File::Spec->join($Config{archlib}, 'CORE') . q{"};
$cppflags =~ s/~/$home_directory/g;
$cppflags .= ' ' . $mm->{INC} if $mm->{INC};
$cppflags .= ' ' . ($mm->{CCFLAGS} || $Config{ccflags});
$cppflags .= ' ' . $mm->{DEFINE} if $mm->{DEFINE};
my $add_include = _is_msvc() ? '-FI' : '-include';
$cppflags .= ' ' . join ' ',
map{ qq{$add_include "$_"} } qw(EXTERN.h perl.h XSUB.h);
my $cppcmd = qq{$Config{cpprun} $cppflags $h_file};
# remove all the -arch options to workaround gcc errors:
# "-E, -S, -save-temps and -M options are not allowed
# with multiple -arch flags"
$cppcmd =~ s/ -arch \s* \S+ //xmsg;
_verbose("extract functions from: $cppcmd") if _VERBOSE;
`$cppcmd`;
};
xt/01_podspell.t view on Meta::CPAN
#!perl -w
use strict;
use Test::More;
eval q{ use Test::Spellunker };
plan skip_all => q{Test::Spellunker is not installed.}
if $@;
add_stopwords(map { /(\w+)/g } <DATA>);
all_pod_files_spelling_ok('lib');
__DATA__
Goro Fuji (gfx)
gfuji(at)cpan.org
Acme::Hidek
hidek
APIs
RT