ok. i'm trying to write a vim plugin that will allow me to visually step through and debug my code.
i discovered this DB.pm module and that seems pretty cool. (maybe it is what activestate uses for their windows gui perl debugger since it was written by a guy who works there?) it seems to be a debugger api type thing that is exactly what i would like to make my life easier. but its not working.
i can't get the debugger to load the file. i try to load the file with:
$self->loadfile( $file, $linenumber )
but that doesn't seem to work. if you actually look at the code for loadfile() in DB.pm, it should return the filename if it succeeds. its not succeeding.
i think i'm doing something fundamentally wrong. any ideas?
here is my code:
#!/usr/bin/perl -w
package PerlDebugger;
use DB;
@ISA = qw( DB );
sub new {
my $type = shift;
my $self = {};
bless $self, $type;
}
sub startDebugger {
my $self = shift;
my $sourceCode = shift;
print "\n>>$sourceCode<<\n";
$self->register();
print ">>" . $self->loadfile( $sourceCode, -1 ) . "<<\n";
print ">>" . $self->ready() . "<<\n";
print "\n>>";
print $DB::filename;
print "<<\n";
}
sub quit {
my $self = shift;
$self->done();
}
package main;
use strict;
my $code = "/home/eric/code/tmp/foo.pl";
my $dbgr = PerlDebugger->new();
$dbgr->startDebugger( $code );
my other option is to not use DB.pm at all and to use open2() on perl -d. which is not as pretty. and the annoying thing with that is the debugger writes to /dev/tty instead using STDOUT and STDIN, and that was giving me fits too because i want vim to display to /dev/tty and the debugger always takes over.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.