Jump to content

Avoid problems with PERL flocked files


TecBrat

Recommended Posts

I am working with a PERL script that writes pipe separated flat files as a DB. I am more comfortable writing in PHP. I want to be able to edit those files with my PHP scripts, but leave the PERL script that generated them, and edits them, in place. The PERL script is the core of the site. The PERL script uses flock to protect the files when the site gets busy enough that more than one request for a file may come at the same time.

I am starting to think it's not compatiable at all, but I wanted to know if anyone has experience trying to make PHP obey an flock placed by PERL, or the other way around.

 

Link to comment
https://forums.phpfreaks.com/topic/43821-avoid-problems-with-perl-flocked-files/
Share on other sites

Can you explain what actually happens to these files when Perl has them flocked? Are the permissions changed?

 

No, it does not chmod the files, I think,(not really sure) that it's more of a "please don't touch that file" sort of thing and the next process has to be smart enough to ask "is that file locked?" before it starts using it.

 

What I'm really unclear on is if the flock is part of perl or part of apache (or other server software) If it's part of apache, I wonder if I can use PHP to check for a Perl lock and vice versa. If it's done in the scripting language, maybe I can ...

I'll stop myself here.

Guess I need to just improve my Perl, then this won't be an issue. (I know there's a big debate on whether to code in PHP or Perl, I think I see a place for both, but just hate the idea of trying to remember, and keep separate in my mind, two sets of syntax.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.