NAME
Vim::Debug - Perl wrapper around a command line debugger
SYNOPSIS
package Vim::Debug;
my $debugger = Vim::Debug->new(
language => 'Perl', # required
invoke => 'perl -Ilib -d t/perl.pl', # required
);
$debugger->start;
sleep(1) until $debugger->read;
print "line: " . $debugger->line . "\n";
print "file: " . $debugger->file . "\n";
print "output: " . $debugger->output . "\n";
$debugger->step; sleep(1) until $debugger->read;
$debugger->next; sleep(1) until $debugger->read;
$debugger->write('help'); sleep(1) until $debugger->read;
$debugger->quit;
DESCRIPTION
If you are new to Vim::Debug please read the user manual, Vim::Debug::Manual, first.
Vim::Debug is an object oriented wrapper around the Perl command line debugger. In theory the debugger could be for any language -- not just Perl. But only Perl is supported currently.
The read() method is non blocking. This allows a user to send an interrupt when they get stuck in an infinite loop.
ATTRIBUTES
invoke
language
stop
line
file
value
status
FUNCTIONS
start()
Starts up the command line debugger in a seperate process.
start() always returns undef.
write($command)
Write $command to the debugger's stdin. This method blocks until the debugger process reads. Be sure to include a newline.
write() always returns undef;
read()
Performs a nonblocking read on stdout from the debugger process. read() first looks for a debugger prompt.
If one is not found, the debugger isn't finished thinking so read() returns 0.
If a debugger prompt is found, the output is parsed. The following information is parsed out and saved into attributes: line(), file(), value(), and out().
read() will also send an interrupt (CTL+C) to the debugger process if the stop() attribute is set to true.
out($out)
If called with a parameter, out() removes ornaments (like <CTL-M> or irrelevant error messages or whatever) from text and saves the value.
If called without a parameter, out() returns the saved value.
translate($in)
Translate a protocol command ($in) to a native debugger command. The native debugger command is returned as an arrayref of strings.
Dies if no translation is found.
SEE ALSO
Vim::Debug::Manual, Vim::Debug::Perl, Devel::ebug, perldebguts
BUGS
In retrospect its possible there is a better solution to this. Perhaps directly hooking directly into the debugger rather than using regexps to parse stdout and stderr?
AUTHOR
Eric Johnson <kablamo at iijo dot nospamthanks dot org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Eric Johnson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.