ExtUtils-MakeMaker
view release on metacpan or search on metacpan
lib/ExtUtils/Command.pm view on Meta::CPAN
eqtime source destination
Sets modified time of destination to that of source.
=cut
sub eqtime
{
my ($src,$dst) = @ARGV;
local @ARGV = ($dst); touch(); # in case $dst doesn't exist
utime((stat($src))[8,9],$dst);
}
=item rm_rf
rm_rf files or directories ...
Removes files and directories - recursively (even if readonly)
=cut
lib/ExtUtils/Command.pm view on Meta::CPAN
=item chmod
chmod mode files ...
Sets UNIX like permissions 'mode' on all the files. e.g. 0666
=cut
sub chmod {
local @ARGV = @ARGV;
my $mode = shift(@ARGV);
expand_wildcards();
if( $Is_VMS_mode && $Is_VMS_noefs) {
require File::Spec;
foreach my $idx (0..$#ARGV) {
my $path = $ARGV[$idx];
next unless -d $path;
# chmod 0777, [.foo.bar] doesn't work on VMS, you have to do
lib/ExtUtils/Command/MM.pm view on Meta::CPAN
--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;
lib/ExtUtils/Command/MM.pm view on Meta::CPAN
=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;
t/MM_Unix.t view on Meta::CPAN
$t->{LIB_EXT} = '.a';
local $t->{NEEDS_LINKING} = 1;
$t->cflags();
# Brief bug where CCFLAGS was being blown away
like( $t->{CCFLAGS}, qr/\-DMY_THING/, 'cflags retains CCFLAGS' );
}
{
my @targv = ("var=don't forget about spaces and single quotes");
local @ARGV = @targv;
my $t = bless { NAME => "Foo", FULLPERL => $0, DIR => [] }, $class;
$t->makeaperl( TARGET => "Tgt" );
is_deeply( \@ARGV, \@targv, 'ARGV is not polluted by makeaperl' );
}
print FILE "stuff\n";
close FILE;
# Instead of sleeping to make the file time older
utime time - 900, time - 900, "source";
END { 1 while unlink "source", "dest"; }
# Win32 bug, cp wouldn't update mtime.
{
local @ARGV = qw(source dest);
cp();
my $mtime = (stat("dest"))[9];
my $now = time;
cmp_ok( abs($mtime - $now), '<=', 1, 'cp updated mtime' );
}
t/eu_command.t view on Meta::CPAN
ok( ! -e $_, "removed $_ successfully" ) for (@ARGV);
# rm_f dir
@ARGV = my $dir = File::Spec->catfile( 'ecmddir' );
rm_rf();
ok( ! -e $dir, "removed $dir successfully" );
}
{
{ local @ARGV = 'd2utest'; mkpath; }
open(FILE, '>d2utest/foo');
binmode(FILE);
print FILE "stuff\015\012and thing\015\012";
close FILE;
open(FILE, '>d2utest/bar');
binmode(FILE);
my $bin = "\c@\c@\c@\c@\c@\c@\cA\c@\c@\c@\015\012".
"\@\c@\cA\c@\c@\c@8__LIN\015\012";
print FILE $bin;
close FILE;
local @ARGV = 'd2utest';
ExtUtils::Command::dos2unix();
open(FILE, 'd2utest/foo');
is( join('', <FILE>), "stuff\012and thing\012", 'dos2unix' );
close FILE;
open(FILE, 'd2utest/bar');
binmode(FILE);
ok( -B 'd2utest/bar' );
is( join('', <FILE>), $bin, 'dos2unix preserves binaries');
( run in 0.726 second using v1.01-cache-2.11-cpan-49f99fa48dc )