[webmin-devel] Coding standards

Fran Fabrizio <[email protected]> Fri, 30 May 2008 14:35:19 -0500
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
I've just inherited a half-dozen or so custom modules from a team member 
who departed.  Looking at his code, it seems that he did not really 
adhere to the style found in the documentation for module developers.  
For instance, each module has its own perl module (ex. Cisweb.pm) and 
therefore its own namespace.  He also does 'use strict' in all of his 
.pm and .cgi files, imports the module via use instead of require, 
doesn't use the %config hash, uses CGI.pm instead of ReadParse, he's 
used HTML::Template to separate HTML from logic, and so on.

I'd like to bring this code back in line with more standard webmin 
module development practices, and I'm trying to decide the best way to 
rework this code.  Some of the things he's done aren't inherently bad 
yet create difficulty in the webmin environment.  I like the idea of 
using .pm's and therefore private namespaces, but this does complicate 
matters a bit because any require '../web-lib.pl' stuff is now going to 
populate the private namespace instead.  I like the idea of doing use 
strict, but this means I'm then going to need to do use vars qw(%config 
%in) if I want to do things like ReadParse and init_config().  I like 
the idea of HTML::Template, and that actually seems to work pretty 
cleanly as-is.  Nevertheless, it's all seeming a bit messy.  :-)

So my question is simply whether anyone has developed an alternative set 
of practices to what's in the module devel docs that incorporates some 
of these practices.  I understand that a lot of webmin's style is 
"dated" because of the desire to support as many platforms and 
environments as possible, but I have full control over the environment 
I'm running in and actually would prefer to do this with modules and 
perhaps ultimately more of an OO style of coding, and I always prefer to 
do use strict, and suppose I will even with the use vars qw() extra 
legwork.  I'm just curious if any of the more seasoned module devels 
have suggestions about how to bridge webmin's style with what I'm more 
used to seeing in my perl experience.

-- 
Fran Fabrizio
Senior Systems Analyst
Department of Computer and Information Sciences
University of Alabama at Birmingham
http://www.cis.uab.edu/
205.934.0653 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel