CPAN Authorship

jfluhmann on 2006-08-11T20:59:55

Hooray! I now have a PAUSE ID and will soon be a CPAN author (if all testing goes well).

The first module I’m putting up is a Win32 IIS admin module. When I worked in Student Activities at Texas A&M University, I maintained the servers that supported the student organization web accounts. The servers were Windows 2000 & 2003 (IIS 5 & IIS 6, respectively). The ‘old’ way of creating new organization accounts was manual and involved a lot of clicking and typing. I developed a script that would do most of the work for me. I had a little bit of trouble finding information about how to create ‘sites’ and ‘virtual sites’ in IIS with Perl. I was finally able to use Win32::OLE to do what I needed.

Someone already uploaded a Win32::IIS::Admin module to the CPAN, but it uses cscript (I have no experience with it). I’m trying to think of a different namespace for mine, and I thought about Win32::IIS::Server. Would that make enough sense for someone? Here’s a sample of how to use it:

use Win32::IIS::Server;
...
my $server = Win32::IIS::Server->new( name => 'www.myserver.com' );
 
# create new site
my $siteIndex = $server->createSite(
    site   => $site,       # test1.myserver.com
    name   => $name,       # Test
    folder => $folder,     # e:\test1\www
);

# create new ftp account
$server->createFTP(
    name   => $name,       # Test
    folder => $folder,     # e:\test1\www
);

#create new virtual site
$server->createVirtual(
    name   => $name,       # test
    folder => $folder,     # e:\test_virtual\www
);

Feel free to offer any thoughts about a different namespace. I’m sure I’ll have some kinks to work out to actually getting the module on the CPAN. I’ve only written modules for myself or work (which had no testing, not much portability, and was a crap shoot on documentation), so getting the module ready for the CPAN will be a new (and thorough) experience. I’ve started incorporating testing into most of my new code, so hopefully I’ll get this right.


Ah, that's you...

bart on 2006-08-12T01:14:59

I think I must have overheard you talking about it on Perlmonks.

My first question is: why a module? From your description in plain English, it looks like it's basically the functionality for a script. Anyway.

Second: I don't like the name. IIS is a webserver. Naming it Win32::IIS::Server is saying roughly the same thing twice.

I propose Win32::IIS::Setup, as it is apparently devised to set up sites on IIS. "Config" might at first sight appear to mean the same thing, but then, I'd expect it to be able to change an existing configuration as well, not only add to it.

Just my 2¢ worth.

Re:Ah, that's you...

jfluhmann on 2006-08-23T18:54:36

Thanks. I'll probably go with ::Setup then. My hope is to also allow the changing of current configurations on a site or virtual site, but I'm not yet familiar enough with all possible configuration options. I'll be doing a little more research and work on it before I upload.

Thanks!

Method naming

Alias on 2006-08-14T06:36:57

I'd note that you should probably be using Perl style method naming.

->create_site instead of ->createSite

I used to have a similar disease, and it wasn't until about a year after I was releasing things regularly that I ended up wishing I'd done things the Perl way in the first place :(

So use a "Perlish" method style. Trust me, you'll regret it if you don't later.

Oh, and I also like Win32::IIS::Setup better than ::Server as well.

Re:Method naming

Alias on 2006-08-14T06:44:39

But I'll add I disagree with "do it as a script".

Most scripts should ideally just be a wrapper around some module that does the real work. Thing of the script as more of a console interface to some functionality.

It should handle launching and command line params and output, but do the work in the module.

And the module should never assume console environment,.

Re:Method naming

jfluhmann on 2006-08-23T18:57:53

Thanks for the encouragement of going with a module rather than a script. I was tossing the idea back and forth in my head for a while. I'll definitely go with doing it as a module now.

Re:Method naming

jfluhmann on 2006-08-23T19:00:04

Thanks. I'll make sure and go for the "Perlish" method style.

I'll more than likely go with ::Setup now instead of ::Server. I want to allow the module to change current configurations, but I'm not familiar enough with all of the configuration options that are available. I'll do some more research on that part.

Re:Method naming

Aristotle on 2006-08-24T12:53:00

Check perlstyle. It’s not gospel, and there’s also Perl Best Practices (which you can’t read online), but it should give you a feel for what Perl code culturally looks like. You are free to deviate from that, of course, but make sure you have reason to. Also, the more visible the deviation (and method names are about as visible as you can get), the better the reason should be.

Re:Method naming

jfluhmann on 2006-08-24T13:43:04

Thanks for the link! I convinced my department to buy a copy of PBP about a month or so ago. I haven't gotten too far in it yet, but I've been reading through it off and on. I appreciate your help!

Re:Method naming

Aristotle on 2006-08-24T23:38:07

Just to be sure, in case you don’t know the site I linked – perldoc.perl.org is an online version of the docs that come with Perl. You can read the same thing by running perldoc perlstyle on your machine. See also perldoc perltoc.

(To be honest, though, these days I use the site much more than the local docs. Browser interfaces with real links are so much nicer, and the pervasively linked, syntax highlighted code snippets on the site are lightyears beyond perldoc on a console. Just noting that this isn’t just some site, but is a browsable version of the official Perl reference documentation.)