V
Volker Nicolai
Hi,
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;
my $DEBUG_TRACE_FH;
my $DEBUG_TRACE_FILENAME = "PERL_DEBUG_TRACE_FILE.log";
open ($DEBUG_TRACE_FH, "> $DEBUG_TRACE_FILENAME");
sub DB {} # Define DB:
B() 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
}
++$hierarchy;
++$callno;
$act_file = $0;
#print "DB: $callno $indent->& SUB: ($act_file) $sub (@_)\n";
print ($DEBUG_TRACE_FH "$callno $indent|--& SUB: $sub (@_)
{$act_file}\n");
&$sub;
--$hierarchy;
}
1;
-------------------------------------------
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
$hierarchy
which is 2 at that time but why?
Sorry for stupidety &
Thanks for helping in advance!
Volker
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;
my $DEBUG_TRACE_FH;
my $DEBUG_TRACE_FILENAME = "PERL_DEBUG_TRACE_FILE.log";
open ($DEBUG_TRACE_FH, "> $DEBUG_TRACE_FILENAME");
sub DB {} # Define DB:
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
}
++$hierarchy;
++$callno;
$act_file = $0;
#print "DB: $callno $indent->& SUB: ($act_file) $sub (@_)\n";
print ($DEBUG_TRACE_FH "$callno $indent|--& SUB: $sub (@_)
{$act_file}\n");
&$sub;
--$hierarchy;
}
1;
-------------------------------------------
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
$hierarchy
which is 2 at that time but why?
Sorry for stupidety &
Thanks for helping in advance!
Volker