Loading ...
Sorry, an error occurred while loading the content.
 

Re: Apache::ASP and debugging with Apache::DB

Expand Messages
  • Maurice Aubrey
    ... The reason for this is that Apache::ASP resets perl s idea of the current line number and filename to make any errors reflect their true location in the
    Message 1 of 6 , Feb 25, 2002
      On Wed, Feb 20, 2002 at 12:42:36AM +1100, Christopher Forkin wrote:
      > I hope this is not a FAQ. When I debug Apache::ASP web-pages with Apache::DB
      > the debugger is not capable of displaying the source-code of the
      > perl-program
      > underlying the ASP webpage (when using debugger commands such as "w" or
      > "l").
      > It has no problems displaying the source-code of Perl-Modules referenced
      > from such
      > pages. Am I missing something here? Can someone enlighten me on how to debug
      > ASP pages with Apache::DB?

      The reason for this is that Apache::ASP resets perl's idea of the
      current line number and filename to make any errors reflect their true
      location in the ASP scripts. But the debugger doesn't seem to
      like that.

      Apache::Registry does this too, but if you take a look at Apache::DB
      you'll notice that it sets $Apache::Registry::MarkLine = 0, which
      suppresses that behavior when running under the debugger.

      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.

      Maurice

      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Joshua Chamas
      ... 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
      Message 2 of 6 , Feb 25, 2002
        Maurice Aubrey wrote:
        >
        > On Wed, Feb 20, 2002 at 12:42:36AM +1100, Christopher Forkin wrote:
        > > I hope this is not a FAQ. When I debug Apache::ASP web-pages with Apache::DB
        > > the debugger is not capable of displaying the source-code of the
        > > perl-program
        > > underlying the ASP webpage (when using debugger commands such as "w" or
        > > "l").
        > > It has no problems displaying the source-code of Perl-Modules referenced
        > > from such
        > > pages. Am I missing something here? Can someone enlighten me on how to debug
        > > ASP pages with Apache::DB?
        > ...
        >
        > 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?

        --Josh
        _________________________________________________________________
        Joshua Chamas Chamas Enterprises Inc.
        NodeWorks Founder Huntington Beach, CA USA
        http://www.nodeworks.com 1-714-625-4051

        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Maurice Aubrey
        ... 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
        Message 3 of 6 , Feb 25, 2002
          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: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Christopher Forkin
          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) ...
          Message 4 of 6 , Feb 27, 2002
            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: asp-unsubscribe@...
            >For additional commands, e-mail: asp-help@...
            >
            >




            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          • Webmaster AutoUa
            Здравствуйте, Christopher Forkin. Сегодня: 1 марта 2002 г. 0:26:45 Where I can find documentations about configurations httpd.conf
            Message 5 of 6 , Feb 28, 2002
              Здравствуйте, Christopher Forkin.

              Сегодня: 1 марта 2002 г. 0:26:45

              Where I can find documentations about configurations httpd.conf and
              .htaccess for mod perl?



              --
              С уважением,
              Ростислав Маленко mailto:webmaster@...

              Список прикрепленных файлов, если есть:
              <none>


              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...
            Your message has been successfully submitted and would be delivered to recipients shortly.