Then first thing you need to do it get yourself a whiteboard. A really big one. Put it on your wall, besides your desk.
If anybody looks at you funny, ignore them.
Make yourself a list of the various different things that your interface can do.
I am going to assume here that this is for intercompany use in a closed network, that is some kind of list management trinket for your organization, that there is no login, etc.
It's just a web front end (a gui (graphical user interface)) to something.
For example.
1)database management
create database
drop database (?)
check database being present
2)querying
list present records
insert new record
replace record
delete record
3)graphical front end
display present records as html
display option to insert new record (form html)
give feedback about new record (success or fail)
Now, let's give namespaces to these things, what should the subs be named?
(Remember, you are still usinng the whiteboard.
Your computer is off.)
# this is PSEUDOCODE
# DATABASE SETUP & MANAGEMENT
sub database_create {}
sub database_check_exists {}
sub database_create_tables {}
sub database_drop {}
# DATABSE QUERYING / INTERACTION
# there is NO html here, this is just code
sub record_new {}
sub record_delete {}
sub records {} # returns ids for all records present
sub record_get{}
sub record_replace {
#this may or may not be how you want to 'replace'
record_delete($id)
record_insert($id,{
vlanid => $vlanid,
ipaddr => $ipaddr,
descr => $descr
});
}
# GRAPHICAL INTERFACE
sub show_records {
my @records = records() ;
for(@records){
record_get()
etc etc
}
What I'm trying to get at is that you should plan out everything. And that you should separate everything. This is not php, the human interface element is the last thing to address.
You want to separate what your code does with the idea of interaction, the html. This is very important.
Your application should be able to get tested, without using a web browser.
Consider developing a test suite, tests.
If you are looking to maybe coding perl for your career, you will learn to use tests.
Later on.. after you know this material.. you will likely be using CGI::Application for something like this.
|