diff options
Diffstat (limited to 'cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm')
-rw-r--r-- | cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm index 880ae24f46..7d004fe359 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm @@ -9,8 +9,8 @@ require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(test_harness pod2man perllocal_install uninstall - warn_if_old_packlist); -our $VERSION = '6.79_01'; + warn_if_old_packlist test_s cp_nonempty); +our $VERSION = '6.80'; my $Is_VMS = $^O eq 'VMS'; @@ -272,8 +272,43 @@ 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; |