Perl debuuger:在运行时错误,debugging器终止与神秘的消息,而不是“捕捉”的错误

注意:根据tuxuday的评论,2012年5月28日编辑,确实是一个Perldebugging器的问题,而不是EPIC / Eclipse – 在最后看到。

我正在Eclipse上运行PERL EPIC,试图debugging一个Perl程序。

我遇到一个奇怪而令人讨厌的问题:当发生运行时错误(例如,试图打开一个不存在的文件)时,EPICdebugging器终止这个神秘的消息(而不是查明错误并提供一个调用跟踪) :

1 at E:/My Documents/Technical/Perl/Eclipse workspace/.metadata/.plugins/org.epic.debug/perl5db.pl line 7800. 

更多细节:

该项目有两个模块:一个名为“Load print copy conv.pl”的Perl程序和一个名为“Utilities.pm”的支持模块。

这里是Utilites.pm代码的一部分,终止发生(例如,如果它试图打开的文件不存在):

 package Utilities; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(OpenFile TimeString PrintT PrintDebug LoadConvTable PrintConv RenumberConv CopyConv LoadParameters CheckParmType CheckParmNo); use strict; use warnings; use Encode; use 5.014; use utf8; use Win32::Console; use autodie; use warnings qw< FATAL utf8 >; use Carp; use Text::Balanced qw< extract_bracketed >; # for extracting between parentheses in LoadConvTable . . . sub OpenFile { # Call: OpenFile (\%FileStruct, $Mode, $Message); my ($FileRef, $Mode, $Message ) =@_; my ($HANDLE, $FileName); $FileName = $FileRef->{FileName}; if ((@_ ==3) && ($Message ne '') ) {say $Message;}; if (! defined $FileName) { confess 'Utilities::OpenFile: $FileName undefined';} my $sta = open ($HANDLE, $Mode, $FileName); if (!$sta) { say "Can't open $HANDLE: $FileName file, exiting"; exit; } else { $FileRef->{HANDLE} = $HANDLE; } # end if (!$sta) return $sta; } # end sub OpenFile . . . sub LoadParameters { my ($i,$j, $ParmFilename); my ($ParmFileRef,$FilesHashRef, $LOG, $Debug) = @_; $ParmFilename = $ParmFileRef->{FileName}; if ( ref($FilesHashRef) ne 'HASH') { say 'LoadParameters: line '.__LINE__.': \$FilesHashRef not a hash reference'; return; } # end if ( ref($FilesHashRef) ne 'HASH') if ((@_<3) || (@_>4)) { say 'LoadParameters: line '.__LINE__.": wrong No of parameters, \@_=@_"; return; } if (@_ == 3) {$Debug = 0}; unless (-e $LOG) { say 'LoadParameters: line '.__LINE__.':\$LOG does not exist'; return; } OpenFile($ParmFileRef, "<", "LoadParameters: opening file:'$ParmFilename'"); my $PARAMETERS = $ParmFileRef->{HANDLE}; while (<$PARAMETERS>) { chomp; say $_; if ( m{^\s*#}) { # parameter line starts with a comment next; } $i = index($_,"\x20"); # find the first space $j = substr($_, $i+1); $$FilesHashRef{substr($_,0,$i)} = $j; }; # while (<$PARAMETERS>) if ($Debug) { while ( ($i,$j) = each %$FilesHashRef) { PrintT($LOG, "$i => $j"); } } # end if ($Debug) close $ParmFileRef->{HANDLE}; } # end sub LoadParameters 

这个问题就出现了,例如,在子OpenFile第7行中,在这个语句中:

 my $sta = open ($HANDLE, $Mode, $FileName); 

软件,版本和系统:在Windows 7上运行的Eclipse版本3.7.1 build M20110909-1335,EPIC版本0.6.44,Active Perl 5.14.2。

在debugging器下运行程序时,它将以消息终止:

 1 at F:/WIN 7 programs/System/Environments/Active Perl/lib/perl5db.pl line 7799. Debugged program terminated. Use q to quit or R to restart DB<1> T $ = DB::fake::at_exit() called from file `F:/WIN 7 programs/System/Environments/Active Perl/lib/perl5db.pl' line 9137 $ = DB::END() called from file `(eval 123)[F:/WIN 7 programs/System/Environments/Active Perl/lib/Fatal.pm:1103]' line 114 $ = eval {...} called from file `(eval 123)[F:/WIN 7 programs/System/Environments/Active Perl/lib/Fatal.pm:1103]' line 114 

Solutions Collecting From Web of "Perl debuuger:在运行时错误,debugging器终止与神秘的消息,而不是“捕捉”的错误"