ExtUtils-MakeMaker
view release on metacpan or search on metacpan
lib/ExtUtils/Command/MM.pm view on Meta::CPAN
=over 4
=item B<test_harness>
test_harness($verbose, @test_libs);
Runs the tests on @ARGV via Test::Harness passing through the $verbose
flag. Any @test_libs will be unshifted onto the test's @INC.
@test_libs are run in alphabetical order.
=cut
sub test_harness {
require Test::Harness;
require File::Spec;
$Test::Harness::verbose = shift;
# Because Windows doesn't do this for us and listing all the *.t files
# out on the command line can blow over its exec limit.
require ExtUtils::Command;
my @argv = ExtUtils::Command::expand_wildcards(@ARGV);
local @INC = @INC;
unshift @INC, map { File::Spec->rel2abs($_) } @_;
Test::Harness::runtests(sort { lc $a cmp lc $b } @argv);
}
=item B<pod2man>
pod2man( '--option=value',
$podfile1 => $manpage1,
$podfile2 => $manpage2,
...
);
# or args on @ARGV
pod2man() is a function performing most of the duties of the pod2man
program. Its arguments are exactly the same as pod2man as of 5.8.0
with the addition of:
--perm_rw octal permission to set the resulting manpage to
And the removal of:
--verbose/-v
--help/-h
If no arguments are given to pod2man it will read from @ARGV.
If Pod::Man is unavailable, this function will warn and return undef.
=cut
sub pod2man {
local @ARGV = @_ ? @_ : @ARGV;
{
local $@;
if( !eval { require Pod::Man } ) {
warn "Pod::Man is not available: $@".
"Man pages will not be generated during this install.\n";
return 0;
}
}
require Getopt::Long;
# We will cheat and just use Getopt::Long. We fool it by putting
# our arguments into @ARGV. Should be safe.
my %options = ();
Getopt::Long::config ('bundling_override');
Getopt::Long::GetOptions (\%options,
'section|s=s', 'release|r=s', 'center|c=s',
'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s',
'fixedbolditalic=s', 'official|o', 'quotes|q=s', 'lax|l',
'name|n=s', 'perm_rw=i', 'utf8|u'
);
delete $options{utf8} unless $Pod::Man::VERSION >= 2.17;
# If there's no files, don't bother going further.
return 0 unless @ARGV;
# Official sets --center, but don't override things explicitly set.
if ($options{official} && !defined $options{center}) {
$options{center} = q[Perl Programmer's Reference Guide];
}
# This isn't a valid Pod::Man option and is only accepted for backwards
# compatibility.
delete $options{lax};
my $count = scalar @ARGV / 2;
my $plural = $count == 1 ? 'document' : 'documents';
print "Manifying $count pod $plural\n";
do {{ # so 'next' works
my ($pod, $man) = splice(@ARGV, 0, 2);
next if ((-e $man) &&
(mtime($man) > mtime($pod)) &&
(mtime($man) > mtime("Makefile")));
my $parser = Pod::Man->new(%options);
$parser->parse_from_file($pod, $man)
or do { warn("Could not install $man\n"); next };
if (exists $options{perm_rw}) {
chmod(oct($options{perm_rw}), $man)
or do { warn("chmod $options{perm_rw} $man: $!\n"); next };
}
}} while @ARGV;
return 1;
}
=item B<warn_if_old_packlist>
lib/ExtUtils/Command/MM.pm view on Meta::CPAN
A wrapper around ExtUtils::Install::uninstall(). Warns that
uninstallation is deprecated and doesn't actually perform the
uninstallation.
=cut
sub uninstall {
my($packlist) = shift @ARGV;
require ExtUtils::Install;
print <<'WARNING';
Uninstall is unsafe and deprecated, the uninstallation was not performed.
We will show what would have been done.
WARNING
ExtUtils::Install::uninstall($packlist, 1, 1);
print <<'WARNING';
Uninstall is unsafe and deprecated, the uninstallation was not performed.
Please check the list above carefully, there may be errors.
Remove the appropriate files manually.
Sorry for the inconvenience.
WARNING
}
=item B<test_s>
perl "-MExtUtils::Command::MM" -e test_s <file>
Tests if a file exists and is not empty (size > 0).
I<Exits> with 0 if it does, 1 if it does not.
=cut
sub test_s {
exit(-s $ARGV[0] ? 0 : 1);
}
=item B<cp_nonempty>
perl "-MExtUtils::Command::MM" -e cp_nonempty <srcfile> <dstfile> <perm>
Tests if the source file exists and is not empty (size > 0). If it is not empty
it copies it to the given destination with the given permissions.
=back
=cut
sub cp_nonempty {
my @args = @ARGV;
return 0 unless -s $args[0];
require ExtUtils::Command;
{
local @ARGV = @args[0,1];
ExtUtils::Command::cp(@ARGV);
}
{
local @ARGV = @args[2,1];
ExtUtils::Command::chmod(@ARGV);
}
}
1;
( run in 1.020 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )