Well, it always seems to start this way for me, too, and then I usually find myself in mission creep and eventually end up with a lot of duplicated effort.

There are reasonable arguments in favor of rolling-your-own instead of using bloated modules, but CGI::Session doesn't seem to be one of the worst offenders.

You could probably get rid of some functionality there, too. For example, you may be sure that you will only ever want to work with postgres and solder that right into your module and throw away the database portability business. But time has a way of slowly rotting sureness away. Suppose the European office of your company starts using your application and they see that the [^a-zA-Z] chars are not sorting the way they were taught in school. Now you need to add COLLATE to your queries, but surprise, postgres does not support that yet, but mysql does (it is possible to use Perl to collate, though probably not as efficiently as the rdbms would do it, but please ignore that, I am just trying to put forth an unexpected situation :). Finding the unstable balance between feature-rich and lightweight can be a dark art.

An important point to consider is maintainability. In my opinion, the real asset of a good CPAN module is its set of tests, even more so than the actual code. When you have accumulated a comprehensive set of tests, and keep adding to the set every time you find a new bug or a potential pitfall that you didn't think of before, then maintenance becomes a breeze. You just patch the code and run the tests, as often as possible. While that does not guarantee that all is well with your patch, it greatly reduces the chance that you just broke something that you coded a few weeks ago and will not even realize that for some time and when you finally do, your new fix will then break your original patch and god knows what else. You should ask yourself whether you are ready to allocate the resources to develop and maintain tests -- not a trivial undertaking -- for a task for which there already is a widely used CPAN module.

My recommendation would be to study the source code of the module and its tests. That is likely to give you a headache for a day, until you internally make it your own. Then you will start finding a little bug here, a nice refactor there and enjoy the joys of sharing. Perhaps you will find that this module is awfully written and you would never rely on anything like it and there, you will have your answer.


In reply to Re^3: Session management: counting number of users currently viewing website and displaying users online by fenLisesi
in thread Session management: counting number of users currently viewing website and displaying users online by stonecolddevin

Title:
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, details, 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, summary, 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.