You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@apache.org on 2005/08/09 17:50:51 UTC

cvs commit: xml-axkit/lib/Apache/AxKit/Language XPathScript.pm

matts       2005/08/09 08:50:51

  Modified:    .        MANIFEST Makefile.PL
               lib      AxKit.pm
               lib/Apache/AxKit Provider.pm
               lib/Apache/AxKit/Language XPathScript.pm
  Log:
  Added some more care around subrequests to make sure they go out of scope
  (this can cause infinite loops if not careful)
  Make sure Makefile.PL calls Apache::TestMM::filter_args before we do our own
  ARGV processing
  Bump ver.
  Log \n's better in exceptions or they look like crap
  
  Revision  Changes    Path
  1.23      +1 -0      xml-axkit/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /home/cvs/xml-axkit/MANIFEST,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MANIFEST	20 Mar 2004 07:06:28 -0000	1.22
  +++ MANIFEST	9 Aug 2005 15:50:49 -0000	1.23
  @@ -211,3 +211,4 @@
   t/provider/01post.t
   t/htdocs/style/provider/01.xsl
   typemap
  +META.yml                                 Module meta-data (added by MakeMaker)
  
  
  
  1.24      +15 -15    xml-axkit/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/xml-axkit/Makefile.PL,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Makefile.PL	17 Sep 2003 21:58:38 -0000	1.23
  +++ Makefile.PL	9 Aug 2005 15:50:49 -0000	1.24
  @@ -45,20 +45,6 @@
     require './install/ExtUtils/AutoInstall.pm';
   }
   
  -######################################################
  -# Standard bits required for have_library and friends
  -my %config;
  -
  -$|=1; # flush output
  -
  -for (@ARGV) {
  -     my ($k, $v) = split /=/, $_, 2;
  -     $config{$k} = $v;
  - }
  -
  -$DEBUG = delete $config{DEBUG};
  -######################################################
  -
   ExtUtils::AutoInstall->import
     ( -version => '0.32',
       -core => [
  @@ -114,6 +100,20 @@
   };
   undef $@;
   
  +######################################################
  +# Standard bits required for have_library and friends
  +my %config;
  +
  +$|=1; # flush output
  +
  +for (@ARGV) {
  +     my ($k, $v) = split /=/, $_, 2;
  +     $config{$k} = $v;
  + }
  +
  +$DEBUG = delete $config{DEBUG};
  +######################################################
  +
   my $xml_parser_found = eval "require XML::Parser";
   
   eval {
  
  
  
  1.56      +8 -4      xml-axkit/lib/AxKit.pm
  
  Index: AxKit.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/AxKit.pm,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- AxKit.pm	14 Jul 2005 18:43:33 -0000	1.55
  +++ AxKit.pm	9 Aug 2005 15:50:50 -0000	1.56
  @@ -38,7 +38,7 @@
   Apache::AxKit::CharsetConv::raise_error(1);
   
   BEGIN {
  -    $VERSION = "1.62";
  +    $VERSION = "1.7";
       if ($ENV{MOD_PERL}) {
           $AxKit::ServerString = "AxKit/$VERSION";
           @AxKit::ISA = qw(DynaLoader);
  @@ -380,7 +380,9 @@
           $r->log->error("[AxKit] From: $E->{-file} : $E->{-line}");
   
           if ($Error::Debug) {
  -            $r->log->error("[AxKit] [Backtrace] " . $E->stacktrace);
  +            # log each line of the stacktrace separately as newer Apache's
  +            # turn \n into \\n.
  +            $r->log->error("[AxKit] [Backtrace] $_") for split(/\n/, $E->stacktrace);
           }
   
           my $error_styles = $AxKit::Cfg->ErrorStyles;
  @@ -395,7 +397,9 @@
           $r->log->error("[AxKit] [UnCaught] $E");
   
           if ($Error::Debug) {
  -            $r->log->error("[AxKit] [Backtrace] " . $E->stacktrace);
  +            # log each line of the stacktrace separately as newer Apache's
  +            # turn \n into \\n.
  +            $r->log->error("[AxKit] [Backtrace] $_") for split(/\n/, $E->stacktrace);
           }
   
           # return error page if a stylesheet for errors has been provided
  
  
  
  1.21      +16 -10    xml-axkit/lib/Apache/AxKit/Provider.pm
  
  Index: Provider.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Provider.pm,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Provider.pm	14 Jul 2005 18:43:33 -0000	1.20
  +++ Provider.pm	9 Aug 2005 15:50:51 -0000	1.21
  @@ -61,9 +61,15 @@
       
       # create a subrequest, so we get the right AxKit::Cfg for the URI
       my $sub = $r->lookup_uri($uri);
  -    local $AxKit::Cfg = Apache::AxKit::ConfigReader->new($sub);
  +    my $cfg = Apache::AxKit::ConfigReader->new($sub);
       
  -    return ($provider_cb?$provider_cb->($sub):__PACKAGE__->new_content_provider($sub));
  +    my $result = do {
  +        local $AxKit::Cfg = $cfg;
  +        ($provider_cb?$provider_cb->($sub):__PACKAGE__->new_content_provider($sub));
  +    };
  +    undef $sub;
  +    undef $cfg;
  +    return $result;
   }
   
   sub get_uri {
  @@ -232,18 +238,18 @@
           # create a subrequest, so we get the right AxKit::Cfg for the URI
           my $apache = AxKit::Apache->request;
           my $sub = $apache->lookup_uri(AxKit::FromUTF8($sysid));
  -        local $AxKit::Cfg = Apache::AxKit::ConfigReader->new($sub);
  +        my $cfg = Apache::AxKit::ConfigReader->new($sub);
       
  -#        warn "File provider ext_ent_handler called with '$sysid'\n";
  -        my $provider = Apache::AxKit::Provider->new($sub);
  -        
  -#        warn "Got provider with key: ", $provider->key, "\n";
  -        my $str = $provider->get_strref;
  -#        warn "Returning string with length: ", length($$str), "\n";
  +        my $str = do {
  +            local $AxKit::Cfg = $cfg;
  +            my $provider = Apache::AxKit::Provider->new($sub);
  +            $provider->get_strref;
  +        };
   
           undef $provider;
           undef $apache;
           undef $sub;
  +        undef $cfg;
           
           return $$str;
       };
  
  
  
  1.14      +8 -4      xml-axkit/lib/Apache/AxKit/Language/XPathScript.pm
  
  Index: XPathScript.pm
  ===================================================================
  RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language/XPathScript.pm,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XPathScript.pm	14 Jul 2005 18:43:34 -0000	1.13
  +++ XPathScript.pm	9 Aug 2005 15:50:51 -0000	1.14
  @@ -170,11 +170,15 @@
       for my $inc (@$includes) {
   #        warn "Checking mtime for $inc\n";
           my $sub = $apache->lookup_uri(AxKit::FromUTF8($inc));
  -        local $AxKit::Cfg = Apache::AxKit::ConfigReader->new($sub);
  +        my $cfg = Apache::AxKit::ConfigReader->new($sub);
           
  -        my $inc_provider = Apache::AxKit::Provider->new_style_provider($sub);
  +        my $changed = do {
  +            local $AxKit::Cfg = $cfg;
  +            my $inc_provider = Apache::AxKit::Provider->new_style_provider($sub);
  +            $inc_provider->has_changed($mtime);
  +        };
           
  -        if ($inc_provider->has_changed($mtime)) {
  +        if ($changed) {
   #            warn "$inc newer (" . $inc_provider->mtime() . ") than last compile ($mtime) causing recompile\n";
               return;
           }