FAQ
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.

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;

Search Discussions

  • Shlomi Fish at Jul 21, 2011 at 1:11 pm
    Hi hsin,

    On Thu, 21 Jul 2011 03:50:36 -0700 (PDT)
    hsin 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 .

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJul 21, '11 at 10:52a
activeJul 21, '11 at 1:11p
posts2
users2
websiteperl.org

2 users in discussion

Shlomi Fish: 1 post Hsin: 1 post

People

Translate

site design / logo © 2022 Grokbase