After consulting the DBI documentation for the umpteenth time to remind myself what parameters go where, I finally decided there had to be a better way. Pondering the problem for a while, I decided that what I really wanted was to be able to write something like this:
use Resource; my $dbh = resource(isa => 'DBI'); ...
When the script is first run a dialog pops up informing me that I need to specify a database connection. It can present a list of connections I've used before or guide me through the creation of a new one. I can also have the setting I select remembered for future runs.

Generalizing this idea, consider the power of this three line program:

my $in = resource(isa => 'ArrayReader'); my $out = resource(isa => 'ArrayWriter'); while ($_ = $in->next) { $out->write($_) }
An ArrayReader is just a generator which creates array refs. For instance, it could represent And, of course, an ArrayWriter is simply something that serializes an array ref.

The point is that once we have this specification we can write a helper program (or 'wizard') to guide the user through the process of creating the ArrayReader and ArrayWriter objects. This frees them from having to remember (or even learn) how to parse a CSV file or invoke a database query, etc. Moreover, the program is now much more general and useful as new wizards for ArrayReader and ArrayWriter objects are implemented.

This is just a preliminary expression of the idea, but I think it really could be worth developing. Comments?


In reply to enabling wizards by pc88mxer

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.