From: Jamie C. <jca...@we...> - 2007-10-11 18:28:36
|
On 11/Oct/2007 05:32 John Gray wrote .. > Jamie Cameron wrote: > > On 10/Oct/2007 15:43 John Gray wrote .. > > > >> I just started using virtualmin, for the most part I really like it. I > >> particularly like the plugin support. I was able to write a plugin for > >> a few misc things we need when a virtual server is created quite easily. > >> (I'd post it, but I doubt its useful to anybody but me). > >> > > > > Hi John, > > > > I'm glad to hear that someone else has used the plugin API successfully .. > > hopefully it wasn't too baroque. I write a few plugins myself, but the > > real test of an API is how easy it is for others to use :) > > > > > Hi Jamie, > > I can give you a little feedback on the ups and downs of a newbie > creating his/her first plugin. First off having a template plugin would > be very nice. That's a good idea - I'll create one and link to it from the plugin docs. > I ended copying a very simple plugin, then replacing the > guts with my own. The next hurdle was getting it registered. I ended > up running the create_domain.pl through the perl debugger and noticed it > was getting the plugins form some config option that did not have my > plugin listed. I'm not sure what I missed when adding it through the > web interface, but I ended up adding it to the config by hand. If you have created a new plugin, to enable it in Virtualmin go to System Settings -> Features and Plugins, and check the box next to it. Also, if this is a new Webmin module, you might first have to delete /etc/webmin/module.infos.cache so that it is detected, and in the Webmin Users module make it available to 'root' or 'admin'. > The last > thing, would be hints on the debugging. I eventually figured out figure > how to get into my plugin quickly by running the perl debugger on > create_domain.pl or delete_domain.pl and jumping to just the right lines > (maybe this is short coming on my perl debugger knowledge, I can't seem > to set a break point in another file). It was also very helpful to > include Data::Dumper in my lib functions file, and dump all the args to > a file when my apis get called. It wasn't very clear all what data I > was going to receive. Yeah, I find STDERR debugging with Data::Dumper to the best method in Webmin, as often you are dealing with CGIs that are hard to attach a regular debugger to. > In the end, it works quite nicely. I'm very happy with how much > virtualmin is doing for me, and that its allowing me to extended it to > handle my servers irregularities easily. Thanks! If you create a plugin that might be useful to others, you can post it at http://www.webmin.com/third.html - Jamie |