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