Olá Pessoal!<br><br>Bem eu estava testando esse script que tem no livro do Deitel (alguns odeiam...eu sei!) sobre criar processos através da função open(). Porém, não consigo executar esse script,pois dá os seguintes erros: <br>
<br>1---&gt; &nbsp; &nbsp;&nbsp; &#39;-&#39; n\xc6o \x82 reconhecido como um comando interno\r<br>2----&gt;&nbsp;&nbsp;&nbsp;&nbsp; ou externo, um programa oper\xa0vel ou um arquivo em lotes.\r<br><br>Eu já li no CPAN, mas sinceramente não consegui achar explicação para isso. Se alguém puder me ajudar, pois estou usando a idéia que está nesse site (<a href="http://www.stonehenge.com/merlyn/LinuxMag/col39.html">http://www.stonehenge.com/merlyn/LinuxMag/col39.html</a>) para execução longa de scripts cgi.<br>
<br>O script é esse:<br><br>-&gt; Ambiente : Windows XP<br><br>#!C:\Perl\bin\perl.exe -w<br># Fig. 18.12: fig18_12.pl<br># Using open to fork and filter output.<br><br>use warnings;<br>use strict;<br><br>$| = 1;<br><br>if ( my $pid = open( CHILD, &#39;-|&#39; ) ) {<br>
&nbsp;&nbsp; my $i;<br><br>&nbsp;&nbsp; while ( &lt;CHILD&gt; ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print( &quot;Line &quot;, ++$i, &quot;: $_&quot; );<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; close( CHILD ) or die( &quot;Cannot close: $!&quot; );<br>}<br>elsif ( defined( $pid ) ) {<br>&nbsp;&nbsp; print( &quot;I am doing some\n&quot; );<br>
&nbsp;&nbsp; print( &quot;processing here\n&quot; );<br>&nbsp;&nbsp; print( &quot;that produces\n&quot; );<br>&nbsp;&nbsp; print( &quot;multiple lines\n&quot; );<br>&nbsp;&nbsp; print( &quot;of output.\n&quot; );<br>&nbsp;&nbsp; exit();<br>}<br>else {<br>&nbsp;&nbsp; print( &quot;Could not fork.&quot; );<br>
}<br><br><br>Obrigado<br>