Good procedural programming

Am I allowed to complain a bit here? it's my blog and so I feel I am allowed to complain a bit.

However with my complaining I will provide a solution that would solve the problem.

So, my problem I am having is this: I am working on a large ball of spaghetti, and I am coming across sub names that are similar to the following: create_user, do_updates_on_primary, etc...

My complaint is this: all of the subroutines take in two variables (sometimes a $dbh, and other setup vars), and then do their work. The two variable names that they always take in: $vars and $q. $vars is a large hash, and $q is exactly what you would expect when in a cgi environment.

These subroutines then use $q and $vars to determine exactly how it should work, and then they do their jobs, including pulling the data out of $q. Instead before calling these functions, there should be a bit of setup ie $user = { attrib1 => $q->param('asdf') }; and then: create_user($user).


About this Entry

This page contains a single entry by leonard published on June 11, 2010 10:06 AM.

Ironman status? was the previous entry in this blog.

Perl! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.