From: miker Date: Wed, 8 Jun 2005 15:28:18 +0000 (+0000) Subject: trimming the fat X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ee80bf76106e0b40f0b69b24fdf4ec5197c14362;p=Evergreen.git trimming the fat git-svn-id: svn://svn.open-ils.org/ILS/trunk@786 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/extras/opensearch.pm b/Open-ILS/src/extras/opensearch.pm index a5dbe8e2ff..6158d89cf8 100644 --- a/Open-ILS/src/extras/opensearch.pm +++ b/Open-ILS/src/extras/opensearch.pm @@ -1,5 +1,6 @@ package opensearch; -use strict; use warnings; +use strict; +use warnings; use Apache2 (); use Apache::Log; @@ -15,46 +16,17 @@ use Template qw(:template); use OpenSRF::EX qw(:try); use OpenSRF::System; -my $child_init_ttk = "opensearch.ttk"; - -my $includes = [ '/pines/cvs/ILS/Open-ILS/src/extras' ]; - -my $plugin_base = 'OpenILS::Template::Plugin'; - sub handler { my $apache = shift; - print "Content-type: text/xml; charset=utf-8\n\n"; - - _process_template( - apache => $apache, - template => 'opensearch.ttk', - ); - - return Apache::OK; -} - -sub child_init_handler { - _process_template( template => $child_init_ttk ); -} - -sub _process_template { - - my %params = @_; - my $ttk = $params{template} || return undef; - my $apache = $params{apache} || undef; - my $pre_process = $params{pre_process} || undef; - my $param_hash = $params{params} || {}; - - my $template; + print "Content-type: application/rss+xml; charset=utf-8\n\n"; - $template = Template->new( { + my $template = Template->new( { OUTPUT => $apache, ABSOLUTE => 1, RELATIVE => 1, - PLUGIN_BASE => $plugin_base, - PRE_PROCESS => $pre_process, - INCLUDE_PATH => $includes, + PLUGIN_BASE => 'OpenILS::Template::Plugin', + INCLUDE_PATH => ['/pines/cvs/ILS/Open-ILS/src/extras'], PRE_CHOMP => 1, POST_CHOMP => 1, } @@ -62,22 +34,24 @@ sub _process_template { try { - if( ! $template->process( $ttk, $param_hash ) ) { + if( ! $template->process( 'opensearch.ttk', $param_hash ) ) { + warn "Error processing template opensearch.ttk\n"; warn "Error Occured: " . $template->error(); my $err = $template->error(); $err =~ s/\n/\/g; - warn "Error processing template $ttk\n"; print "
Unable to process template:

" . $err . "!!!
"; } } catch Error with { my $e = shift; - warn "Error processing template $ttk: $e - $@ \n"; + warn "Error processing template opensearch.ttk: $e - $@ \n"; print "


Error

$e

$@

"; return; }; -} + return Apache::OK; +} + 1;