view release on metacpan or search on metacpan
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
argument whose value is a whitespace-separated list of test scripts to
run. This is especially useful in development, when you only want to
run a single test to see whether you've squashed a certain bug yet:
./Build test --test_files t/something_failing.t
You may also pass several C<test_files> arguments separately:
./Build test --test_files t/one.t --test_files t/two.t
or use a C<glob()>-style pattern:
./Build test --test_files 't/01-*.t'
=item testall
[version 0.2807]
[Note: the 'testall' action and the code snippets below are currently
in alpha stage, see
L<"http://www.nntp.perl.org/group/perl.module.build/2007/03/msg584.html"> ]
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
The action name must come at the beginning of the line, followed by any
amount of whitespace and then the options. Options are given the same
as they would be on the command line. They can be separated by any
amount of whitespace, including newlines, as long there is whitespace at
the beginning of each continued line. Anything following a hash mark (C<#>)
is considered a comment, and is stripped before parsing. If more than
one line begins with the same action name, those lines are merged into
one set of options.
Besides the regular actions, there are two special pseudo-actions: the
key C<*> (asterisk) denotes any global options that should be applied
to all actions, and the key 'Build_PL' specifies options to be applied
when you invoke C<perl Build.PL>.
* verbose=1 # global options
diff flags=-u
install --install_base /home/ken
--install_path html=/home/ken/docs/html
installdeps --cpan_client 'cpanp -i'
If you wish to locate your resource file in a different location, you
can set the environment variable C<MODULEBUILDRC> to the complete
absolute path of the file containing your options.
=head2 Environment variables
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
sub _find_user_config {
my $self = shift;
my $file = shift;
foreach my $dir ( $self->_home_dir ) {
my $path = File::Spec->catfile( $dir, $file );
return $path if -e $path;
}
return undef;
}
# read ~/.modulebuildrc returning global options '*' and
# options specific to the currently executing $action.
sub read_modulebuildrc {
my( $self, $action ) = @_;
return () unless $self->use_rcfile;
my $modulebuildrc;
if ( exists($ENV{MODULEBUILDRC}) && $ENV{MODULEBUILDRC} eq 'NONE' ) {
return ();
} elsif ( exists($ENV{MODULEBUILDRC}) && -e $ENV{MODULEBUILDRC} ) {
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
} else {
$buffer .= $line;
}
}
if ( $buffer ) { # anything left in $buffer ?
my( $action, $options ) = split( /\s+/, $buffer, 2 );
$options{$action} .= $options . ' '; # merge if more than one line
}
my ($global_opts) =
$self->read_args( $self->split_like_shell( $options{'*'} || '' ) );
my ($action_opts) =
$self->read_args( $self->split_like_shell( $options{$action} || '' ) );
# specific $action options take priority over global options '*'
return $self->_merge_arglist( $action_opts, $global_opts );
}
# merge the relevant options in ~/.modulebuildrc into Module::Build's
# option list where they do not conflict with commandline options.
sub merge_modulebuildrc {
my( $self, $action, %cmdline_opts ) = @_;
my %rc_opts = $self->read_modulebuildrc( $action || $self->{action} || 'build' );
my %new_opts = $self->_merge_arglist( \%cmdline_opts, \%rc_opts );
$self->merge_args( $action, %new_opts );
}
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
return $self->find_test_files;
}
sub expand_test_dir {
my ($self, $dir) = @_;
my $exts = $self->{properties}{test_file_exts};
return sort map { @{$self->rscan_dir($dir, qr{^[^.].*\Q$_\E$})} } @$exts
if $self->recursive_test_files;
return sort map { glob File::Spec->catfile($dir, "*$_") } @$exts;
}
sub ACTION_testdb {
my ($self) = @_;
local $self->{properties}{debugger} = 1;
$self->depends_on('test');
}
sub ACTION_testcover {
my ($self) = @_;
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
return {};
}
sub find_test_files {
my $self = shift;
my $p = $self->{properties};
if (my $files = $p->{test_files}) {
$files = [keys %$files] if UNIVERSAL::isa($files, 'HASH');
$files = [map { -d $_ ? $self->expand_test_dir($_) : $_ }
map glob,
$self->split_like_shell($files)];
# Always given as a Unix file spec.
return [ map $self->localize_file_path($_), @$files ];
} else {
# Find all possible tests in t/ or test.pl
my @tests;
push @tests, 'test.pl' if -e 'test.pl';
push @tests, $self->expand_test_dir('t') if -e 't' and -d _;
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
if ( ! -x $command ) {
die "cpan_client '$command' is not executable\n";
}
$self->do_system($command, @opts, @install);
}
sub ACTION_clean {
my ($self) = @_;
$self->log_info("Cleaning up build files\n");
foreach my $item (map glob($_), $self->cleanup) {
$self->delete_filetree($item);
}
}
sub ACTION_realclean {
my ($self) = @_;
$self->depends_on('clean');
$self->log_info("Cleaning up configuration files\n");
$self->delete_filetree(
$self->config_dir, $self->mymetafile, $self->build_script
inc/inc_Module-Build/Module/Build/Compat.pm view on Meta::CPAN
delete $prereq{perl};
$MM_Args{PREREQ_PM} = \%prereq;
$MM_Args{INSTALLDIRS} = $build->installdirs eq 'core' ? 'perl' : $build->installdirs;
$MM_Args{EXE_FILES} = [ sort keys %{$build->script_files} ] if $build->script_files;
$MM_Args{PL_FILES} = $build->PL_files || {};
if ($build->recursive_test_files) {
$MM_Args{test} = { TESTS => join q{ }, $package->_test_globs($build) };
}
local $Data::Dumper::Terse = 1;
my $args = Data::Dumper::Dumper(\%MM_Args);
$args =~ s/\{(.*)\}/($1)/s;
print $fh <<"EOF";
use ExtUtils::MakeMaker;
WriteMakefile
$args;
EOF
}
}
sub _test_globs {
my ($self, $build) = @_;
return map { File::Spec->catfile($_, '*.t') }
@{$build->rscan_dir('t', sub { -d $File::Find::name })};
}
sub subclass_dir {
my ($self, $build) = @_;
return (Module::Build::ModuleInfo->find_module_dir_by_name(ref $build)
inc/inc_Module-Build/Module/Build/Platform/VMS.pm view on Meta::CPAN
my $self = shift;
my $mpname = $self->SUPER::man3page_name( shift );
my $sep = $self->manpage_separator;
$mpname =~ s/^$sep//;
return $mpname;
}
=item expand_test_dir
Inherit the standard version but relativize the paths as the native glob() doesn't
do that for us.
=cut
sub expand_test_dir {
my ($self, $dir) = @_;
my @reldirs = $self->SUPER::expand_test_dir( $dir );
for my $eachdir (@reldirs) {
my ($v,$d,$f) = File::Spec->splitpath( $eachdir );
my $reldir = File::Spec->abs2rel( File::Spec->catpath( $v, $d, '' ) );
$eachdir = File::Spec->catfile( $reldir, $f );
}
return @reldirs;
}
=item _detildefy
The home-grown glob() does not currently handle tildes, so provide limited support
here. Expect only UNIX format file specifications for now.
=cut
sub _detildefy {
my ($self, $arg) = @_;
# Apparently double ~ are not translated.
return $arg if ($arg =~ /^~~/);
inc/inc_Module-Build/Module/Build/Platform/VMS.pm view on Meta::CPAN
=cut
sub localize_dir_path {
my ($self, $path) = @_;
return VMS::Filespec::vmspath($path);
}
=item ACTION_clean
The home-grown glob() expands a bit too aggressively when given a bare name,
so default in a zero-length extension.
=cut
sub ACTION_clean {
my ($self) = @_;
foreach my $item (map glob(VMS::Filespec::rmsexpand($_, '.;0')), $self->cleanup) {
$self->delete_filetree($item);
}
}
# Need to look up the feature settings. The preferred way is to use the
# VMS::Feature module, but that may not be available to dual life modules.
my $use_feature;
BEGIN {