Hi, I played around with ASP.pm and came up with the following solution to my debugging information (based on Joshua's and Maurice's recommendations) ------------<cut here>------------ *** ASP.pm 2002/02/28 00:02:56 1.29 --- ASP.pm 2002/02/28 00:05:17 1.29.1.1 *************** *** 58,67 **** --- 58,68 ---- # $r->register_cleanup #$Apache::ASP::Register = undef; #@Apache::ASP::Cleanup = (); # DEFAULT VALUES + $Apache::ASP::MarkLines = 1; $Apache::ASP::SessionTimeout = 1200; $Apache::ASP::StateManager = 10; $Apache::ASP::StartTime = time(); $Apache::ASP::CompileErrorSize = 500; @CompileChecksumKeys = qw ( Global DynamicIncludes UseStrict XMLSubsMatch XMLS ubsStrict GlobalPackage UniquePackages IncludesDir InodeNames PodComments ); *************** *** 316,325 **** --- 317,329 ---- # includes_dir => $r->dir_config('IncludesDir'), # includes_dir => [ '.', $global, split(/;/, $r->dir_config('IncludesDir ') || '') ], inode_names => $r->dir_config('InodeNames'), + mark_lines => defined($r->dir_config('MarkLines'))? + $r->dir_config('MarkLines'): + $Apache::ASP::MarkLines, # move to error # mail_alert_to => $r->dir_config('MailAlertTo'), # mail_errors_to => $r->dir_config('MailErrorsTo'), # moved to mailalert *************** *** 1464,1473 **** --- 1468,1478 ---- sub Compile { my($self, $script, $subid) = @_; $subid ||= $self->{subid}; my $package = $self->{'package'}; + $$script =~ s/^\#line\s+\d+.*$//mgo unless $self->{'mark_lines'}; $self->CompilePerl($script, $subid, $package); ! $self->{errs}; } sub CompileChecksum { *************** *** 3021,3030 **** --- 3026,3037 ---- $asp->{dbg} && $asp->Debug("compiling global.asa $self->{'package'} $id ex ists $exists", $self, '---', $compiled); $code =~ /^(.*)$/s; $code = $1; + $code =~ s/^\#line\s+\d+.*$//mgo unless $self->{'mark_lines'}; + # only way to catch strict errors here if($asp->{use_strict}) { local $SIG{__WARN__} = sub { die("maybe use strict error: ", @_) }; eval $code; } else { *************** *** 5639,5649 **** # This library is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); ! $VERSION = sprintf("%d.%02d", q$Revision: 1.29 $ =~ /(\d+)\.(\d+)/); sub Version { $VERSION; } require 5.002; require Exporter; @ISA = qw(Exporter); --- 5646,5656 ---- # This library is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); ! $VERSION = sprintf("%d.%02d", q$Revision: 1.29.1.1 $ =~ /(\d+)\.(\d+)/); sub Version { $VERSION; } require 5.002; require Exporter; @ISA = qw(Exporter); ------------<cut here>------------ (context diff with "rcsdiff -r1.29 -r1.29.1.1 -C 5 ASP.pm") I basically removed the "#line ..." comments from the perl code just before it was "eval"ed based on if "MarkLines" is set to false (0). Thanks for the assistance. Maybe something like this could be incorporated into Apache::ASP. I like the normal behaviour of displaying errors with the lines matched up to the original code in the asp files. However I find debugging with Apache::DB very helpfull for tricky problems and therefore needed a solution like the above. I am quite suprised that this is not a FAQ. Maybe not very many users of Apache::ASP are aware of Apache::DB, in which case this might be something to add to the documentation and/or examples? All in all I am extremely pleased with Apache::ASP and would like to thank all those who have put so much effort into such an fantastic product. Regards, Chris.
Maurice Aubrey wrote: >On Mon, Feb 25, 2002 at 01:33:58PM -0800, Joshua Chamas wrote: > >>Maurice Aubrey wrote: >> >>>The quick fix is to remove the line numbering stuff. >>>The real fix is to make it configurable and maybe just honor the >>>$Apache::Registry::MarkLine value. >>> >>I could make Apache::ASP honor the Apache::Registry::MarkLine value >>for this purpose, but pretty soon now, I will be making the subroutines >>that are compiled named by MD5 checksums, so if one does a &Carp::confess, >>the stack will not yield anything meaningful when using Apache::DB. >> >>Would this be OK? Might it be possible instead to have Apache::DB >>understand standard perl #line directives? >> > >I don't know. I think this is a general debugger issue and not >specific to Apache::DB. Here's some test code that elicits the >problem: > >#!/usr/bin/perl > >my $s = <<EOF; > package A; > >#line 1 foofile > sub foo { > for (1..5) { > print "Ni! \$_\n"; > } > } >EOF > >eval $s; >die $@ if $@; > >my $subid = 'A::foo'; >&$subid(); > >At least under perl 5.6.0, if I leave the #line directive in there >then the debugger doesn't display the statements when I enter foo(); >if I remove it, everything works. > >Maurice > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]