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:
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.use Resource; my $dbh = resource(isa => 'DBI'); ...
Generalizing this idea, consider the power of this three line program:
An ArrayReader is just a generator which creates array refs. For instance, it could representmy $in = resource(isa => 'ArrayReader'); my $out = resource(isa => 'ArrayWriter'); while ($_ = $in->next) { $out->write($_) }
- data from a CSV file
- the result set of an SQL query
- an HTML table scraped from a remote web site
- ...
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: enabling wizards
by Anonymous Monk on May 23, 2008 at 01:13 UTC | |
Re: enabling wizards
by holli (Abbot) on May 22, 2008 at 23:58 UTC | |
Re: enabling wizards
by dragonchild (Archbishop) on May 23, 2008 at 00:15 UTC | |
Re: enabling wizards
by ioannis (Abbot) on May 25, 2008 at 12:13 UTC | |
Re: enabling wizards
by mr_mischief (Monsignor) on May 28, 2008 at 20:33 UTC |
Back to
Meditations