++ed by:
AYOUNG SKREUZER ZMUGHAL

3 PAUSE user(s)
1 non-PAUSE user(s).

Eric D Johnson

NAME

Vim::Debug - Perl wrapper around a command line debugger

SYNOPSIS

    package Vim::Debug;

    my $debugger = Vim::Debug->new(
        language => 'Perl',
        invoke   => 'perl -Ilib -d t/perl.pl 42',
    );

    $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.

METHODS

language

The language that the debugger is made to handle. Currently, only 'Perl' is supported.

invoke

The string used to invoke the debugger, for example 'perl -Ilib -d t/perl.pl 42',

stop

line

file

value

status

start()

Starts up the command line debugger in a separate process.

Returns $self.

write($command)

Write $command to the debugger's stdin. This method blocks until the debugger process reads. Be sure to include a newline.

Return value should be ignored.

read()

Performs a non-blocking read on stdout from the debugger process. read() first looks for a debugger prompt.

If none is 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 protocol command $in to a native debugger command, returned as an arrayref of strings.

Dies if no translation is found.

state()

Returns a hash (a list actually) whose keys are qw<stop line file value status output>, and whose values are the corresponding values of the object.

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.




Hosting generously
sponsored by Bytemark