]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/opensearch.pm
viewable mime time
[Evergreen.git] / Open-ILS / src / extras / opensearch.pm
1 package opensearch;
2 use strict;
3 use warnings;
4
5 use Apache2 ();
6 use Apache::Log;
7 use Apache::Const -compile => qw(OK REDIRECT :log);
8 use APR::Const    -compile => qw(:error SUCCESS);
9 use Apache::RequestRec ();
10 use Apache::RequestIO ();
11 use Apache::RequestUtil;
12
13 use CGI ();
14 use Template qw(:template);
15
16 use OpenSRF::EX qw(:try);
17 use OpenSRF::System;
18
19 sub handler {
20
21         my $apache = shift;
22         print "Content-type: text/xml; charset=utf-8\n\n";
23
24         my $template = Template->new( { 
25                 OUTPUT                  => $apache, 
26                 ABSOLUTE                        => 1, 
27                 RELATIVE                        => 1,
28                 PLUGIN_BASE             => 'OpenILS::Template::Plugin',
29                 INCLUDE_PATH    => ['/pines/cvs/ILS/Open-ILS/src/extras'], 
30                 PRE_CHOMP               => 1,
31                 POST_CHOMP              => 1,
32                 } 
33         );
34
35         try {
36
37                 if( ! $template->process( 'opensearch.ttk' ) ) { 
38                         warn "Error processing template opensearch.ttk\n";      
39                         warn  "Error Occured: " . $template->error();
40                         my $err = $template->error();
41                         $err =~ s/\n/\<br\/\>/g;
42                         print "<br><b>Unable to process template:<br/><br/> " . $err . "!!!</b>";
43                 }
44
45         } catch Error with {
46                 my $e = shift;
47                 warn "Error processing template opensearch.ttk:  $e - $@ \n";   
48                 print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";
49                 return;
50         };
51
52
53
54         return Apache::OK;
55 }
56
57 1;