|
Posted by Bill H on June 8, 2008, 6:46 am
Please log in for more thread options On Jun 7, 3:37=A0pm, xmp...@yahoo.com wrote:
> Hi,
>
> The last line of the following code snippet fails:
>
> open FILE, '<file.dat' || die '...';
> process(FILE);
> close FILE;
> system('command file.dat');
>
> It looks like FILE is still locked because if I break out the last
> line into a separate script, it works. =A0In fact, if I open FILE on
> another file, the last line also works. =A0I'd like to fix the issue
> with something more elegant than re-opening the handle on a dummy
> file.
>
> Any suggestions? =A0I'm using ActiveState Perl on Windows running in a
> DOS shell.
>
> Thanks.
I believe this is more a function of Windows. I have had similiar
experiences with other software. If I open a in some programs just to
view it I find that I can't u/l it to a server with an ftp program
cause it is locked. When I close it I can.
I think the same thing is happening here, when you do the "system"
command windows is starting a new instance of command this new
instance cant access the file cause your original instance is "using"
the file.
If your perl code isn't doing anything after you make file.dat maybe
you could have an initial batch file that runs the perl script then
runs the file.dat pert after perl has exited.
Bill H
|