[open-ils-commits] r7596 - trunk/Open-ILS/src/perlmods/OpenILS/WWW

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jul 27 13:16:06 EDT 2007


Author: miker
Date: 2007-07-27 13:14:47 -0400 (Fri, 27 Jul 2007)
New Revision: 7596

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
Log:
use mod_perl API instead of print

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm	2007-07-27 16:58:06 UTC (rev 7595)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm	2007-07-27 17:14:47 UTC (rev 7596)
@@ -79,10 +79,13 @@
 
 	my $ses = OpenSRF::AppSession->create('open-ils.cstore');
 
-	print "Content-type: application/octet-stream\n\n" if (uc($format) ne 'XML');
-	print <<"	HEADER" if (uc($format) eq 'XML');
-Content-type: application/xml
+	$r->content_type('application/octet-stream') if (uc($format) ne 'XML');
+	$r->content_type('application/xml') if (uc($format) eq 'XML');
 
+	my $content = '';
+
+
+	$content .= <<"	HEADER" if (uc($format) eq 'XML');
 <?xml version="1.0" encoding="$encoding"?>
 <collection xmlns='http://www.loc.gov/MARC21/slim'>
 	HEADER
@@ -131,7 +134,7 @@
 		next unless $bib;
 
     		if (uc($format) eq 'BRE') {
-        		print OpenSRF::Utils::JSON->perl2JSON($bib);
+        		$content .= OpenSRF::Utils::JSON->perl2JSON($bib);
         		next;
     		}
 
@@ -191,11 +194,11 @@
 			if (uc($format) eq 'XML') {
 				my $x = $r->as_xml_record;
 				$x =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>//o;
-				print $x;
+				$content .= $x;
 			} elsif (uc($format) eq 'UNIMARC') {
-				print $r->as_unimarc
+				$content .= $r->as_unimarc
 			} elsif (uc($format) eq 'USMARC') {
-				print $r->as_usmarc
+				$content .= $r->as_usmarc
 			}
 
 		} otherwise {
@@ -205,9 +208,10 @@
 
 	}
 
-	print "</collection>\n" if ($format eq 'XML');
+	$content .= "</collection>\n" if ($format eq 'XML');
 
-	return 200;
+	$r->print($content);
+	return Apache2::Const::OK;
 
 }
 



More information about the open-ils-commits mailing list