You say: Im a novice . Nothing wrong with that, everybody starts. I am saying that this flock() stuff can be a lot more complex in the "always works" details than you think.
There is a big difference between "works all the time" and works "almost all the time". The coordination and sequencing of asynchronous events is hard -> this is NOT something that I would recommend for a self proclaimed novice -> the pitfalls are many!
At the same time, I think that you are over estimating the effort to do some simple SQL statements (Perl is great at SQL stuff!). I think the total amount of SQL related code will be like 1/2 page in your application.
One of the issues with a DB is how to set it up, maintain it, etc.
I recommend the most basic DB, DB::CSV. You will probably also need
SQL::Statement and Text::CSV_XS. Unfortunately DB::CSV doesn't work
on Windows. I hope that you have a Unix variant to test with.
The rationale behind my recommendation of DB::CSV is to get the SQL part figured out. You will wind up with an application that "works" albiet not as fast as it could. All the SQL code will "port" to the "fancy DB" after you get the basic thing working.
Initailizing the CSV DB is simple, it is a Comma Separate Value file. So this is a text file that can be generated from say an Excel spreadsheet or other ways. Your data has 5 fields, I think the user id is unique although that won't matter if it is not.
This may seem like a "stupid question" on my part, but I am compelled to ask it because it could result in a vast simplification of the problem.
I need to save name, username, time, and two other numerical parameters. You don't need to use a dynamic database update if what is in the database currently doesn't matter. In other words, supplying completely new data for a username is a very different thing than updating info for that user based upon what is was in the DB for that user. If you just want the "latest info" for that username, this is very different than a DB read/update situation. Multiple processes can open a file for append. No need for flock() as long as each "record" is terminated by a "\n", ie a single line of output. If this is the case, then we generate a report/update the main DB file periodically (on demand or very 12 hours, etc). Again, my question sounds "goofy", but it is important to make sure that this is NOT "goofy".
In reply to Re: Flock to Rename Directory
by Marshall
in thread Flock to Rename Directory
by virtualweb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |