Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to vim perl debugger integration by toiletmonster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-03-29 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found