From a47fb78160ec6291a8072ec591d78b07533a860a Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 27 Jul 2007 17:14:47 +0000 Subject: [PATCH] use mod_perl API instead of print git-svn-id: svn://svn.open-ils.org/ILS/trunk@7596 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm b/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm index dda6626329..fba67a898b 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm @@ -79,10 +79,13 @@ sub handler { 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'); HEADER @@ -131,7 +134,7 @@ Content-type: application/xml 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 @@ Content-type: application/xml 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 @@ Content-type: application/xml } - print "\n" if ($format eq 'XML'); + $content .= "\n" if ($format eq 'XML'); - return 200; + $r->print($content); + return Apache2::Const::OK; } -- 2.11.0