Maybe try the explicit three argument form of the perl open function instead of the magic two argument form....?<div><br></div><div>i.e. :</div><div>open( FILEHANDLE, &quot;&gt;&quot;, &quot;file.txt&quot; ) ......</div><div>
<br></div><div><br></div><div>HTH,</div><div>David</div><div><br><br><div class="gmail_quote">On Mon, Jun 8, 2009 at 10:37 AM, Pierre-Julien Villoud <span dir="ltr">&lt;<a href="mailto:PVilloud@movea.com">PVilloud@movea.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">








<div lang="FR" link="blue" vlink="purple">

<div>

<p><span lang="EN-US">Hi,</span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">I am using some perl scripts to complete tasks
in the install target. I have no problem launching the script , but I found
myself with non working code inside the script and I don’t why.</span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">Inside my script I do that:</span></p>

<p style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A000F0">open</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">( </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black">FILEHANDLE</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue">&quot;&gt;file.txt&quot;
</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">) || </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A020F0">die</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue">&quot;Could not
open file!&quot;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">);</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;"></span></p>

<p style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A000F0">print </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue">&quot;opening
uninstfile $uninstfile\n&quot;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;"></span></p>


<p><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A000F0">print </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black">FILEHANDLE </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue">&quot;I need to
print this in the file\n&quot;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">;</span><span lang="EN-US"></span></p>

<p style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A000F0">close</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black">FILEHANDLE</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#B22200">);</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;"></span></p>


<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">This code works if I launch the script from
the command line, but fails from within cmake</span></p>

<p><span lang="EN-US">The handle opens the file but never prints
to it. I suppose there is a problem with a redirection, but I don’t know
what.</span></p>

<p><span lang="EN-US">I really need a solution for that as my
script needs to work inside and outside cmake.</span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">Anyone can help?</span></p>

<p> </p>

</div>

</div>


<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>