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 jw...@apache.org on 2002/06/04 19:21:31 UTC
cvs commit: xml-axkit/lib/Apache/AxKit/Language XSP.pm
jwalt 2002/06/04 10:21:30
Modified: lib AxKit.pm
lib/Apache/AxKit ConfigReader.pm
lib/Apache/AxKit/Language XSP.pm
Log:
second try - somehow the second half of this patch got lost
Revision Changes Path
1.18 +39 -2 xml-axkit/lib/AxKit.pm
Index: AxKit.pm
===================================================================
RCS file: /home/cvs/xml-axkit/lib/AxKit.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- AxKit.pm 31 May 2002 19:22:23 -0000 1.17
+++ AxKit.pm 4 Jun 2002 17:21:30 -0000 1.18
@@ -1,4 +1,4 @@
-# $Id: AxKit.pm,v 1.17 2002/05/31 19:22:23 matts Exp $
+# $Id: AxKit.pm,v 1.18 2002/06/04 17:21:30 jwalt Exp $
package AxKit;
use strict;
@@ -18,6 +18,7 @@
use Apache::AxKit::CharsetConv;
use File::Basename ();
use Compress::Zlib ();
+use Fcntl;
Apache::AxKit::CharsetConv::raise_error(1);
@@ -577,13 +578,22 @@
sub process_request {
my ($r, $provider, $styles) = @_;
my $result_code = OK;
-
+
my $num_styles = 0;
for my $style (@$styles) {
AxKit::Debug(4, "styles: ", $style->{module}, "(", $style->{href}, ")");
$num_styles++;
}
+ my $interm_prefix;
+ my $interm_count = 0;
+ if ($AxKit::Cfg->TraceIntermediate) {
+ $interm_prefix = $r->uri;
+ $interm_prefix =~ s{/}{|}g;
+ $interm_prefix =~ s/[^0-9a-zA-Z.,_|-]/_/g;
+ $interm_prefix = $AxKit::Cfg->TraceIntermediate.'/'.$interm_prefix;
+ }
+
while (@$styles) {
my $style = shift @$styles;
@@ -623,6 +633,23 @@
);
}
+ if ($interm_prefix) {
+ my $fh = Apache->gensym();
+ if (sysopen($fh, $interm_prefix.'.'.$interm_count, O_WRONLY|O_CREAT|O_TRUNC)) {
+ if (my $dom_tree = $r->pnotes('dom_tree')) {
+ syswrite($fh,$dom_tree->toString);
+ } elsif (my $xmlstr = $r->pnotes('xml_string')) {
+ syswrite($fh,$xmlstr);
+ } else {
+ syswrite($fh,"<?xml version='1.0'?>\n<empty reason='no data found'/>");
+ }
+ close($fh);
+ $interm_count++;
+ } else {
+ AxKit::Debug(1,"could not open $interm_prefix.$interm_count for writing: $!");
+ }
+ }
+
AxKit::Debug(3, "execution of: $mapto\::$method finished");
last if $r->notes('axkit_passthru');
@@ -1047,6 +1074,16 @@
use this option on a live server.
AxDebugLevel 5
+
+=head2 AxTraceIntermediate
+
+With this option you advise AxKit to store the result of each transformation
+request in a special directory for debugging. This directory must exist and must
+be writeable by the httpd. The files are stored with their full uri, replacing
+slashes with '|', and appending a number indicating the transformation step.
+'.0' is the xml after the first transformation.
+
+ AxTraceIntermediate /tmp/axkit-trace
=head2 AxStackTrace
1.8 +12 -1 xml-axkit/lib/Apache/AxKit/ConfigReader.pm
Index: ConfigReader.pm
===================================================================
RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/ConfigReader.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConfigReader.pm 2 Jun 2002 18:41:54 -0000 1.7
+++ ConfigReader.pm 4 Jun 2002 17:21:30 -0000 1.8
@@ -1,4 +1,4 @@
-# $Id: ConfigReader.pm,v 1.7 2002/06/02 18:41:54 matts Exp $
+# $Id: ConfigReader.pm,v 1.8 2002/06/04 17:21:30 jwalt Exp $
package Apache::AxKit::ConfigReader;
@@ -153,6 +153,17 @@
return $self->{cfg}{StackTrace} ||
$self->{apache}->dir_config('AxStackTrace') ||
0;
+}
+
+sub TraceIntermediate {
+ my $self = shift;
+ if (my $dir = $self->{cfg}{TraceIntermediate} ||
+ $self->{apache}->dir_config('AxTraceIntermediate')) {
+ return undef if $dir =~ m/^\s*(?:off|none|disabled?)\s*$/i;
+ return $dir;
+ }
+
+ return undef;
}
sub LogDeclines {
1.13 +2 -2 xml-axkit/lib/Apache/AxKit/Language/XSP.pm
Index: XSP.pm
===================================================================
RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language/XSP.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XSP.pm 29 May 2002 13:06:35 -0000 1.12
+++ XSP.pm 4 Jun 2002 17:21:30 -0000 1.13
@@ -1,4 +1,4 @@
-# $Id: XSP.pm,v 1.12 2002/05/29 13:06:35 matts Exp $
+# $Id: XSP.pm,v 1.13 2002/06/04 17:21:30 jwalt Exp $
package Apache::AxKit::Language::XSP;
@@ -950,7 +950,7 @@
my $provider = Apache::AxKit::Provider->new_content_provider($sub);
- add_depends($provider->key());
+ AxKit::add_depends($provider->key());
my $str = $provider->get_strref;
undef $provider;