Add commandline debug options
authorRyan Jendoubi <ryan.jendoubi@gmail.com>
Wed, 20 Jun 2012 00:34:45 +0000 (01:34 +0100)
committerRyan Jendoubi <ryan.jendoubi@gmail.com>
Wed, 20 Jun 2012 23:38:14 +0000 (00:38 +0100)
commit43aa273a9403641708ceff025f701b54627a467a
tree16d18296e1706c808a0ed56502b613baa53330b4
parent649253fae9e8e7ff7de95702d2705514cd134d0e
Add commandline debug options

A debug level can now be passed to Ctypes using "--debug <num>"
on the command line.

The _debug() routine, which replaces all instances of "print $foo
if $Debug", is in Ctypes::Util, which has consequently been split
out into its own .pm file. I think this might help some ugly
cyclical dependencies which were present (although some may
remain).

The first argument to _debug is a number, the debug level of the
message. Messages <= the debug level passed at the command line
are displayed; e.g. "--debug 3" would output all debug messages
numbered 1, 2 or 3.

Most messages have been preliminarily set to debug level 5.
Messages notifying sub entry or exit are at 4.

I envision some time in the future adding the option of
displaying only debug messages from certain packages. API
suggestions welcome.

modified:   MANIFEST
modified:   lib/Ctypes.pm
modified:   lib/Ctypes/Function.pm
modified:   lib/Ctypes/Type.pm
modified:   lib/Ctypes/Type/Array.pm
modified:   lib/Ctypes/Type/Field.pm
modified:   lib/Ctypes/Type/Simple.pm
modified:   lib/Ctypes/Type/Struct.pm
new file:   lib/Ctypes/Util.pm
modified:   t/Simple.t
modified:   t/Struct.t
MANIFEST
lib/Ctypes.pm
lib/Ctypes/Function.pm
lib/Ctypes/Type.pm
lib/Ctypes/Type/Array.pm
lib/Ctypes/Type/Field.pm
lib/Ctypes/Type/Simple.pm
lib/Ctypes/Type/Struct.pm
lib/Ctypes/Util.pm [new file with mode: 0644]
t/Simple.t
t/Struct.t