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

OH I see like this: perl -MExtUtils::Command -e touch test.txt ; Thanks I must need more coffee today!

Replies are listed 'Best First'.
Re^4: ExtUtils::Command touch
by aturtle (Novice) on Jan 13, 2014 at 21:33 UTC
    How do I get that to work in a module?
      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