Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

What kind out output would you want from a module's Debug option?

by ajt (Prior)
on Apr 08, 2003 at 12:54 UTC ( [id://248912]=perlquestion: print w/replies, xml ) Need Help??

ajt has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks!

In an ideal world what kind of built-in debugging features would you like a module to have?

At the moment I'm working on an RSS module (XML::RSS::Tools), and I'm pretty sure it's near completion. During the development phase I have tended to scatter print statments throughout it to see what is going on, but now I'm looking at enabling proper end-user debugging information.

I've used some modules that dump staggering amounts of data to STDERR, and I've seen some that do pretty much nothing. I know there is the sophisticated Log4perl and simple Carp warn option. But which do people actually prefer?

My module is OO, and has a method to set a debug level, and read the level, and it's possible to dump the internal state of the module at various steps manually from the interface, but at the moment turning debugging on, doesn't actually do anything!

As I recently asked I don't want to bloat the module, When is a feature bloat?, but I think a debug option can be useful. This module interacts with data feeds that are outside the users control, so I think it's useful to debug things when you don't get the result you expect: XML::RSS; Using RSS; How do I clean RSS feeds to make them usable?; and Why so slow from CGI, but not command line?.


--
ajt
  • Comment on What kind out output would you want from a module's Debug option?

Replies are listed 'Best First'.
Re: What kind out output would you want from a module's Debug option?
by MZSanford (Curate) on Apr 08, 2003 at 13:05 UTC

    I think this is an aspect of module interface design too often ignored. I personally like the debug interface for Net::FTP. Most of us have used the module, but it's debug feature always seems to give me the info i need in the event of problems. A second choice for me is the style used by DBI (very similar).

    Just my €0.02
    from the frivolous to the serious
Re: What kind out output would you want from a module's Debug option?
by chromatic (Archbishop) on Apr 08, 2003 at 18:19 UTC

    What kind of debugging features do *you* need? Where can the module fail and why? How would you explain those failures if you weren't using the module?

Re: What kind out output would you want from a module's Debug option? ([cf]allbacks please)
by Aristotle (Chancellor) on Apr 09, 2003 at 10:05 UTC
    Log::Log4perl is an excellent choice, but adds a dependency. I'd suggest to have a fallback mechanism so that you can utilize the module but don't depend on it; it then comes nearly for free to give the user the opportunity to provide his own callback instead. When dealing with CGI scripts, I often wish I had an easy way to capture error and debug messages to display them in some way other than what's common.

    Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://248912]
Approved by hawtin
Front-paged by particle
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-19 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found