#!/usr/bin/perl -w use strict; use lib 'lib'; use MT::Bootstrap; use CGI::Fast; use CGI::Cache; use MT::App::XSearch; eval { CGI::Cache::setup({ cache_options => { cache_root => './cache', default_expires_in => 600 } }); while (my $q = new CGI::Fast) { my $cgi_cache = $q->param('cgi_cache') || 0; if ($cgi_cache) { CGI::Cache::set_key($q->Vars); CGI::Cache::start() or next; } my $app = MT::App::XSearch->new(CGIObject => $q) or die MT::App::XSearch->errstr; local $SIG{__WARN__} = sub { $app->trace($_[0]) }; MT->set_instance($app); $app->init_request(CGIObject => $q) unless $app->{init_request}; $app->run; CGI::Cache::stop($app->errstr ? 0 : 1) if $cgi_cache; } }; if ($@) { print "Content-Type: text/html\n\n"; print "Got an error: $@"; }