Lately I've gotten into the habit of writing modules by starting with a script that usually takes the form:

  package Some::Name;

  ...

  package Some::Other::Name;

  ...

  package main;

  use Test::More;

  ...

For me it's easier than using h2xs since I'm not always sure what the namespace will be, or how many packages it will have, etc.

In other words, I start off with a proof of concept 'hack' that evolves into a module. (When I start with h2xs, I find I am constantly renaming things, moving them around, etc.)

So the obvious thing to do is to have a kind of 'hack2pack' script that parses the script and generates the appropriate modules, and test file. The script can probably generate most of the POD automatically by looking for subroutines as "sub", and even generate Build.PL/Makefile.PL by looking for "use" and "require". (Yes, it won't be 100% but it will save me a bunch of work.)

What do you all think of the idea?

Regards,
Rob

Reply via email to