Attaching a debugger to a file being eval'd?

[email protected] (doug brann) Mon, 8 Jan 2007 12:24:40 -0800 (PST)
Newsgroups perl.debugger
Message-ID <[email protected]>
--0-1720420767-1168287880=:41174
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi all,

I am running VMS perl 5.8.6. I am using persistent perl and am eval'ing a file.

The problem is, sometimes I want to eval the file to debug it. To make matters worse, I need to use ptkdb to do the debugging.

I've tried the obvious things like putting perl -d:ptkdb into the first line of the file, and putting "use Devel::ptkdb" into PERL5LIB and PERLDBOPT all to no avail.

Is this even possible?

Thanks in advance,

-Doug 

Code snippet follows:


  ...{
        local *FH;
        open FH, $filename or die "open '$filename' $!";
        local($/) = undef;
        my $sub = <FH>;
        close FH;

        #wrap the code into a subroutine inside our unique package
        my $eval = qq{package $package; sub handler { $sub; }};
        {
            # hide our variables within this block
            my($filename,$mtime,$package,$sub);
            eval $eval;
        }
        die $@ if $@;
 
        #cache it unless we're cleaning out each time
        $Cache{$package}{mtime} = $mtime unless $delete;
     }

     eval {$package->handler;};
     die $@ if $@;


 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
--0-1720420767-1168287880=:41174--