DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

LWP::DebugFile



NAME

LWP::DebugFile - routines for tracing/debugging LWP


SYNOPSIS

If you want to see just what LWP is doing when your program calls it, add this to the beginning of your program's source:

  use LWP::DebugFile;

For even more verbose debug output, do this instead:

  use LWP::DebugFile ('+');


DESCRIPTION

This module is like LWP::Debug in that it allows you to see what your calls to LWP are doing behind the scenes. But it is unlike LWP::Debug in that it sends the output to a file, instead of to STDERR (as LWP::Debug does).


OPTIONS

The options you can use in use LWP::DebugFile (options) are the same as the non-exporting options available from use LWP::Debug (I<options>). That is, you can do things like this:

  use LWP::DebugFile qw(+);
  use LWP::Debug qw(+ -conns);
  use LWP::Debug qw(trace);

The meanings of these are explained in the documentation for LWP::Debug. The only differences are that by default, LWP::DebugFile has cons debugging on, ad that (as mentioned earlier), only non-exporting options are available. That is, you can't do this:

  use LWP::DebugFile qw(trace); # wrong

You might expect that to export LWP::Debug's trace() function, but it doesn't work -- it's a compile-time error.


OUTPUT FILE NAMING

If you don't do anything, the output file (where all the LWP debug/trace output goes) will be in the current directory, and will be named like lwp_3db7aede_b93.log, where 3db7aede is $^T expressed in hex, and b93 is $$ expressed in hex. Presumably this is a unique-for-all-time filename!

If you don't want the files to go in the current directory, you can set $LWP::DebugFile::outpath before you load the LWP::DebugFile module:

  BEGIN { $LWP::DebugFile::outpath = '/tmp/crunk/' }
  use LWP::DebugFile;

Note that you must end the value with a path separator (``/'' in this case -- under MacPerl it would be ``:''). With that set, you will have output files named like /tmp/crunk/lwp_3db7aede_b93.log.

If you want the LWP::DebugFile output to go a specific filespec (instead of just a uniquely named file, in whatever directory), instead set the variable $LWP::DebugFile::outname, like so:

  BEGIN { $LWP::DebugFile::outname = '/home/mojojojo/lwp.log' }
  use LWP::DebugFile;

In that case, $LWP::DebugFile::outpath isn't consulted at all, and output is always written to the file /home/mojojojo/lwp.log.

Note that the value of $LWP::DebugFile::outname doesn't need to be an absolute filespec. You can do this:

  BEGIN { $LWP::DebugFile::outname = 'lwp.log' }
  use LWP::DebugFile;

In that case, output goes to a file named lwp.log in the current directory -- specifically, whatever directory is current when LWP::DebugFile is first loaded. $LWP::DebugFile::outpath is still not consulted -- its value is used only if $LWP::DebugFile::outname isn't set.


ENVIRONMENT

If you set the environment variables LWPDEBUGPATH or LWPDEBUGFILE, their values will be used in initializing the values of $LWP::DebugFile::outpath and $LWP::DebugFile::outname.

That is, if you have LWPDEBUGFILE set to /home/mojojojo/lwp.log, then you can just start out your program with:

  use LWP::DebugFile;

and it will act as if you had started it like this:

  BEGIN { $LWP::DebugFile::outname = '/home/mojojojo/lwp.log' }
  use LWP::DebugFile;


IMPLEMENTATION NOTES

This module works by subclassing LWP::Debug, (notably inheriting its import). It also redefines &LWP::Debug::conns and &LWP::Debug::_log to make for output that is a little more verbose, and friendlier for when you're looking at it later in a log file.


SEE ALSO

the LWP::Debug manpage


COPYRIGHT AND DISCLAIMERS

Copyright (c) 2002 Sean M. Burke.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.


AUTHOR

Sean M. Burke sburke@cpan.org