Hello o' wise ones!
I was reading some articles and tutorials on .NETs DataGrid object, and i said wow! thats kinda cool! And i wanted it for myself!
But i wanted it to do more, to make it more data driven.
Looking at how i have been coding recently, i have observed a few patterns.
I have a data object. A class, containing fields. These fields have types, restrictions, etc.
Now what do i generally do with this object?
1) I render it to screen (via html), in a variety of formats(a brief view, a detailed view, etc)
2) I validate the field data (max length, ensure they are ints and of proper ranges, ensure the email is typed the same in both fields, etc)
3) I edit the data object fields (some of them) via html forms
4) I load the data object from some persistant storage mechanism (mySQL)
5) I save the data object to some persistant storage
6) create perl scripts from the command line which also loads, validates and saves to/from the same data object. I use this for data cleaning, creating quick and dirty reports, etc.
After doing the above a few times, i have found that performing the above is quite tedious, error prone, and boring. Kind of reminds me of coding in C/C++.
I thought of creating some text file which describes the data fields, enough so that all the above operations can be performed, without writing any additional code.
so the only code you would need to code up would look like this...
my $object = new datagrid("myDataTextFile.txt");
$object->render(); # kicks out html form code
if ($object->isValid())
{
$object->save();
}
as you can see, the code is kinda abstract, and isnt hard coded to your data. All the information regarding your data is in the text file supplied in the constructor. The text file would contain dbase field names, types, restriction info, rendering info, text descriptions, etc
by creating a generic datagrid perl class, i think all my needs could be met, making this boring task trivial! (i hope).
I was wondering, has this already been done? Please, tell me to download module XXX on CPAN, and that it does everything you wanted and more.
and if it hasnt been done, would anyone like to write one with me? Have suggestions? feature wishs?
I thank you for your time!
--rob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.