Date:   Tuesday December 11, 2001 @ 11:20
Author: matt

Update of /home/cvs/AxKit/lib/Apache/AxKit/Language
In directory ted:/home/matt/Perl/AxKit/lib/Apache/AxKit/Language

Modified Files:
        AxPoint.pm 
Log Message:
Lots of debugging added

Index: AxPoint.pm
===================================================================
RCS file: /home/cvs/AxKit/lib/Apache/AxKit/Language/AxPoint.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AxPoint.pm  2001/07/17 20:35:47     1.9
+++ AxPoint.pm  2001/12/11 11:20:17     1.10
@@ -1,4 +1,4 @@
-# $Id: AxPoint.pm,v 1.9 2001/07/17 20:35:47 matt Exp $
+# $Id: AxPoint.pm,v 1.10 2001/12/11 11:20:17 matt Exp $
 
 package Apache::AxKit::Language::AxPoint;
 
@@ -12,6 +12,7 @@
 use Apache::AxKit::Provider;
 use PDFLib 0.02;
 use XML::XPath;
+use File::Basename ();
 
 my @xindent;
 
@@ -20,7 +21,7 @@
 sub handler {
     my $class = shift;
     my ($r, $xml_provider, undef, $last_in_chain) = @_;
-    
+
     my $xpath = XML::XPath->new();
     
     my $source_tree;
@@ -59,6 +60,8 @@
     }
     
     $xpath->set_context($source_tree);
+
+    AxKit::Debug(7, "AxPoint: creating pdf");
     
     my $pdf = PDFLib->new();
     $pdf->papersize("slides");
@@ -69,23 +72,35 @@
     
     my ($logo_node) = $xpath->findnodes("/slideshow/metadata/logo");
     my ($bg_node) = $xpath->findnodes("/slideshow/metadata/background");
+
+    AxKit::Debug(7, "AxPoint: loading main bg/logo images");
     
     my ($logo, $bg);
     if ($logo_node) {
         $logo = $pdf->load_image(
             filename => $logo_node->string_value,
             filetype => get_filetype($logo_node->string_value),
-            )
-            || die "Cannot load image $logo_node!";
+            );
+        if (!$logo) {
+            AxKit::Debug(7, "AxPoint: failed to load logo " . 
+$logo_node->string_value);
+            $pdf->finish;
+            die "Cannot load image $logo_node!";
+        }
     }
     
     if ($bg_node) {
         $bg = $pdf->load_image(
             filename => $bg_node->string_value,
             filetype => get_filetype($bg_node->string_value),
-            )
-            || die "Cannot load image $bg_node!";
+            );
+        if (!$bg) {
+            AxKit::Debug(7, "AxPoint: failed to load logo " . $bg_node->string_value);
+            $pdf->finish;
+            die "Cannot load image $bg_node!";
+        }
     }
+
+    AxKit::Debug(7, "AxPoint: Creating new_page sub");
     
     my $new_page = sub {
         my ($node) = @_;
@@ -111,7 +126,8 @@
             
         $pdf->set_text_pos(80, 300);
     };
-        
+    
+    AxKit::Debug(7, "AxPoint: creating front page");
     # title page
     $new_page->($xpath->findnodes('/')->get_node(1));
     
@@ -143,6 +159,8 @@
             x => 20, y => $y - 10, w => 570, h => 24);
     $pdf->print_boxed($xpath->findvalue("/slideshow/metadata/organisation"),
             x => 20, y => 40, w => 570, h => $y - 24, mode => "center");
+
+    AxKit::Debug(7, "AxPoint: creating slides");
     
     foreach my $slideset ($xpath->findnodes("/slideshow/*[name() = 'slideset' or 
name() = 'slide']")) {
         if ($slideset->getName() eq 'slide') {
@@ -152,8 +170,12 @@
             process_slideset($pdf, $new_page, $slideset, $root_bookmark);
         }
     }
+
+    AxKit::Debug(7, "AxPoint: outputting pdf");
     
     $r->content_type("application/pdf");
+
+    AxKit::Debug(5, "finish pdf");
     
     $pdf->finish;
     
@@ -343,6 +365,8 @@
 
 sub get_filetype {
     my $filename = shift;
+
+    AxKit::Debug(8, "AxPoint: get_filetype($filename)");
     
     my ($suffix) = $filename =~ /([^\.]+)$/;
     $suffix = lc($suffix);
@@ -372,6 +396,7 @@
     }
 
     # warn("get_source_tree = $source_tree\n");
+    AxKit::Debug(7, "AxPoint: returning source tree"); 
     return $source_tree;
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to