Hi hsin, On Thu, 21 Jul 2011 03:50:36 -0700 (PDT) hsin <[email protected]> wrote:
> I came across this error when I run follow code on windows. > and if changed the command `dir` to `ipconfig`, it's ok. > I guess it because dir is a cmd internal command but ipconfig isn't. I think that's the case. You shouldn't depend on "dir" from within Perl anyway because Perl has native and portable routines and modules to query the file system: http://perl-begin.org/uses/sys-admin/ Regards, Shlomi Fish > > Can anybody explain it for me. > > Thanks > > code: > > use strict; > use IPC::Run qw(run timeout); > > my @cmd = qw(dir); > my ($in, $out, $error); > open $in, "<in.txt"; > open $out, ">out.txt"; > open $error, ">error.txt"; > > run \@cmd, $in, $out, $error, timeout(10) or die "error: $?"; > > close $in; > close $out; > close $error; > > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Understand what Open Source is - http://shlom.in/oss-fs Chuck Norris is a real programmer. He writes programs by implementing the most optimised machines for them using real atoms. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
