in reply to Add,Insert,Change,Delete File / Array
Well, aside from using CGI three things: you should move the call to exit out of all the different subs and place it after your dispatch code (repeated code is bad); you're not locking the database file (perldoc -f flock); and your dispatch code might be a little cleaner this way:
my %actions = ( Add => \&Add, Delete => \&Delete, Show => \&Show, ... ); if( length( $action ) ) { $actions{ $action }->( ); } else { Show(); } exit 0;
That way you just have to maintain the dispatch table in the %actions hash rather than having n different if statements (repeated code bad, again :).
|
|---|