Writing a Perl Debugger - problems with xsloader

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I have written a nice little debugger routine, to generate a
trace of subs,(just a bit more than in man perldebguts)
put it into the DB package, told Perl via env vars to use it
and ran some scripts. Looked fine.
Then I typed
[237] hh10s068% perldoc -l Devel::Trace

and got that:

3 at /opt/perl/lib/5.6.1/Carp.pm line 121.
Undefined subroutine &main::2 called at
/opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi/XSLoader.pm line 97.
Compilation failed in require at /opt/perl/bin/perldoc line 22.
BEGIN failed--compilation aborted at /opt/perl/bin/perldoc line 22.

My code looks as follows:

package DB;                

my $callno = 0;        
my $hierarchy = 0;    


sub DB  {}                # Define DB::DB() to be empty.

sub sub {                
  my $indent = "";            # Indentation string.
  my $act_file;                # File name of the actual sub.
  my $i;
  for ($i = 0; $i < $hierarchy; $i++) {
    $indent .= "   ";            # generate indent
  $act_file = $0;        
  #print "DB: $callno $indent->& SUB: ($act_file) $sub (@_)\n";
  print ($DEBUG_TRACE_FH "$callno $indent|--& SUB: $sub (@_)



So what's up there?? I don't get it.
The xsloader line is that:
    return &$xs(@_);

Seems as if Perl tries to invoke "main::" with the current value of
which is 2 at that time but why?

Sorry for stupidety &
Thanks for helping in advance!

Site Timeline