Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I think that you are vasty under estimating the complexity of implementing a robust flock (file lock) mechanism by yourself.

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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (9)
    As of 2020-01-17 15:32 GMT
    Find Nodes?
      Voting Booth?