in reply to Re^3: ExtUtils::Command touch
in thread ExtUtils::Command touch

How do I get that to work in a module?

Replies are listed 'Best First'.
Re^5: ExtUtils::Command touch
by choroba (Cardinal) on Jan 13, 2014 at 21:56 UTC
    Should I really copy all the documentation here?
    and NOT like this:
    perl -MExtUtils::Command -e 'some_command qw(some files to work on)'
    For that use Shell::Command.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      I did read that I am just learning perl. I am looking for an example for use in a pm file: ExtUtils::Command::touch test.txt Does not work as expected from inside a pm I would expect the following code to create two files in the current directory:
      #!/usr/bin/perl package Debug; use strict ; use warnings ; sub test { use ExtUtils::Command; my ( $path ) = @_ ; my ($file, $count); my @files = ('test.txt','test-1.txt'); foreach $file (@files) { if ($path) {$file = "$path/$file"} $count++; print "$file\n"; ExtUtils::Command::touch $file || ($count--, print "$file not update +d\n") ; } print "$count files updated\n"; } 1;
      If I run the command perl -MDebug -e 'Debug::test(".")' it reports no errors and no files are created EDIT oops posted wrong code --fixed