hopes has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks!:

I've several problems with qx and system on a windows machine.
This is the code I'm running:
#c:\perl\bin\perl.exe -w use CGI 'param','header'; print header('text/plain'); print "Dir:\n"; print `cmd.exe /c dir c:\\temp`; print "\n\nver:\n"; print `cmd.exe /c ver -a`; exit(0);

and this is the result:
Dir: Acceso denegado. ver: Microsoft Windows 2000 [Versi¢n 5.00.2195]
If I run the code in my own windows machine or in a linux machine, it works correctly;
but if I run the code in a "production machine" I can´t execute a dir command.
(I can execute 'copy', 'ver', etc etc, but no 'dir')
I think that is a permission problem... but I don't know which are the permissions Perl need in this case.

c:\temp has rwx permissions for all
%windir\system32 has rx permmisions for all
%windir has rx permmisions for all
.pl is mapped to perl.exe %s %s
c:\perl has read permisions for all
I'm using activeperl 5.6.1 build 626

Does anybody kwow how Perl makes system calls?
Which are the dlls or files that Perl need to make this system calls?

Of course, the 'dir' is only an example; what I have to make is a call to a third program. This system call doesn't work.
Thanks in advance


Hopes
$_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s, $_^=q,$\^-]!,,print

Replies are listed 'Best First'.
Re: A system call
by vladb (Vicar) on May 15, 2002 at 17:37 UTC
    There are a few readily available modules that might help you with your question. One of them is the Win32::Process. You can read an excellent piece of documentation (including sample code) here.

    Remember, Google is also your friend in this. Here are a few news group threads that seem to relate to a similar problem (or at least have dose of extra code for you to glance over ;):

    I hope this helps you, Hopes. ;)

    _____________________
    $"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/;$_=&#91"ps -e -o pid | "," $2 | "," -v "," "]`@$_`?{print" ++ $1"}:{print"- $1"}&&`rm $1`;print"\n";}
Re: A system call
by atopolc (Pilgrim) on May 15, 2002 at 16:20 UTC
    It might help to look at the internals for Shell.pm I know there is a section inside for Win32