Herein I describe how I intend to use Apache::Session as data storage for a web-based survey tool, and ask for comments on alternatives and dangers.

At the website where I work, we use a combination of CGI::Application and Template-Toolkit for our applications. Because of the structure and modularization this encourages, along with the various sub-units in our agency, we develop our applications in a generic sense whenever possible. So instead of 15 modules that send email from a form, we have a "Form2Email" module that can be set to use some custom templates and custom variables in the instance script. (And avoid the Dangers of rolling your own mail script) Ditto for apps to create a searchable database from any given CSV file, contact lists, message boards, etc.

Recently, we've been called upon to do some surveys. We're big fans of roll-you-own, particularly when it lets us integrate everything, and this didn't look to be too much of a challenge. The first versions worked fine, but I spent a lot of time converting their (ick) word docs into: templates for each "page" of the survey, an instance script that contained Data::FormValidator profiles for all the pages, and a database with the appropriate fields. (That last was particularly hairy, since a "Check all that apply"-style question resulted in a column for each potential answer, and Postgres is less friendly to table manipulation than our previous MySQL setup)

We also haven't done any data reporting from these surveys yet. The expectation is to dump to a CSV via Text::xSV (or .xls using Spreadsheet::WriteExcel, but we prefer CSV) and let the end users manipulate the data using their tools.

In the name of Laziness, I'm looking to reduce the work involved in creating these surveys. We could use commercial tools, but they cost money, can't integrate as well, and put the onus on the end user to create the survey details ("if 'no', go to question 6 "-style things). I don't mind undergoing the word -> template step, since that keeps my unit involved in the HTML creation where we don't want Joe User playing, and the Data::FormValidator profiles aren't too difficult (I can also probably script up a parser to read in my templates and output a "guessed" instance script that I just need to touch up.) That leaves the database.

So here's my idea: Use Apache::Session to track the surveys. It can store any kind of data I need, it can track them by an id, so if I want them to be able to come back and modify their answers, I have that option, and I don't have to worry about creating and maintaining database columns. Each instance of the survey tool can be given it's own table, configurable in the instance script. Since use of the survey doesn't need a relational database beyond retrieving the data associated with the id, and my results tool will just grab all the data, I don't suffer a penalty there.

But before I embark on creating this beast, I thought I'd double-check in the community and make sure of two things:

  1. I'm not missing an obvious better solution
  2. There isn't a weakness in using Apache::Session that I'm missing. (We're using Postgres if it matters)
Comments welcome!

In reply to Using Apache::Session to create a generic survey tool by swiftone

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.