Lately, I've been fine-tuning a module that I've been working on that allows easy debugging of cgi variables. This module has saved me many hours of work on CGI scripts and it occurred to me that a CPAN submission might be in order. However, I thought I would bounce a few thoughs off of my fellow Monks first.

As far as I can tell, there is no other module out there that duplicates the functionality of this module. CGI::Debug comes close, but is better suited debugging the CGI environment, where I am trying to facilitate debugging the variables themselves. In my experience, once the debugging of the environment is complete, the vast majority of the of debugging that is done is finding out what values are being passed where. Seeing that $index is undef tells me volumes about my logic.

CGI::DebugVars allows for conditions to be set up (e.g. don't print output unless $someVar eq $someVal), globally disabling all DebugVars statements (very handy once you think the script is close to production), and a variety of other features to fine-tune its behavior.

For example, let's say you want to print the contents of %some_hash, figure out what you've put into your $query object, examine the contents of $x, allow the CGI script to continue running, but only if $x is greater than 3:

DebugVars( SomeHash => \%some_hash, CGIObject => $query, X => $x, -continue => 1, -condition => "$x > 3" );
In the above example, you can add -continue => 0 to kill the script if DebugVars is encountered (but only if the condition, if used, is true), or simply omit the -continue key, as the default is false. You can also add -active => 0 to selectively turn off a DebugVars without going through the hassle of commenting and uncommenting it every time. To turn off 20 DebugVars statements, just toss this in the beginning of the script:
$CGI::DebugVars::Disable = 1;
The POD needs a a bit of work and I am considering adding a -package feature that would dump all values in a package's namespace to a table.

My Questions:

Is it worthy of CPAN? I know that much could be done with it, but it is so configurable and has saved me so many hours of debugging that I imagine others would appreciate it. I thought at first that it was rather piddly, but after seeing Bone::Easy, Sex and other modules on CPAN, I can hardly imagine that this would be the least usefule module out there :)

From the submission guidines:

Contact the author of an existing module and ask whether your new features would fit into his framework.
Should I contact the author of CGI::Debug? The concept of my script is actually something that might be useful in non-CGI programs, but I have tailored it to use the CGI module because this is most of the Perl work that I do. Since it is not really specific to the CGI environment (other than creating tables), it seems to be comparing apples and oranges... though I acknowledge their relation.

And yes, I would be checking http://www.xray.mpe.mpg.de/mailing-lists/modules/ before actually submitting anything.

Any and all suggestions welcome, even if you tell me I'm wasting time :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

Replies are listed 'Best First'.
RE: CPAN Submissions
by clemburg (Curate) on Nov 03, 2000 at 04:21 UTC

    Have you had anyone else using your module? That should answer the most basic questions very fast.

    Documenting your module, writing tests for it, and making it conform to the standard installation procedure will also help in the decision.

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com

RE: CPAN Submissions
by AgentM (Curate) on Nov 03, 2000 at 06:08 UTC
    Really, it's all up to you. I definitely see different functionality from CGI::Debug, but contacting the author certainly wouldn't hurt. Why not ask the author himself if this is appropriate for another module or whether he believes that his implementation could support yours easily in a future release or with CGI::Debug::Vars (which obviously doesn't exist, so dont click it)? I certainly find your code useful to ALL CGI coders, so I would try to imagine if this code SHOULD be combined with CGI::Debug. Open it up and look if the current manner of implementation looks similar. Could this code involve a quick function call or is it better off as a complete object/package (even potentially a subclass of CGI::Debug (which I believe, is not)? Your object seems to contain very feature-specific data which i would easily throw in a package and be quite content about. Since you yourself have doubts about whether this is relevant to CGI::Debug, I would consider the matter settled, but it's probably worth your time to ask the author about it. Unfortunately, the name of CGI::Debug is already taken and your package is certainly not a subclass of CGI::Debug, so it's pretty evident that your current naming scheme is most descriptive.
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
RE: CPAN Submissions
by Rudif (Hermit) on Nov 07, 2000 at 04:53 UTC
    Not knowing either your or his module, I'll hazard a suggestion: do contact the author of CGI::Debug. If you 2 could work out a merge, the rest of us would benefit: 2 cool modules for the price of 1.
    Rudif