Christian Stalp wrote:
> Hello together,
> I have a question regarding process-control. I want to write a perl
> script which must not running in more than one process in the same
> time. The script creates a directory copys a zip-file in it, unpack
> it and reads every file in this package. However, the files must not
> get opened by another process. 

Are you extracting the files just to read through them? Why not just extract
to a pipe and read the data from that? Then you can avoid creating the files
in the first place?

> How can I make sure, that my perl-scipt runs only in one process

This is typically done by acquiring a lock on a file (usually a "pid" file
that contains the process id number). There's a Proc::PID::File module on
CPAN that looks pretty neat, though I haven't used it personally.

> , or
> eaysier, is there a function "flock" which blocks a whole directory
> and not only a single file?

Not really a way to do that with a lock, and locks are "advisory" only,
depending on your O/S. You might want to play with directory permissions...

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to