--- no_pager/index.cgi 2006/08/15 15:43:31 2 +++ no_pager/index.cgi 2006/08/16 23:37:51 18 @@ -3,104 +3,165 @@ use strict; use CGI::Simple; -use CGI::Carp qw(fatalsToBrowser); +use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Search::Estraier; +use YAML::Syck; +use JSON::Syck; +use Data::Dump qw/dump/; my $q = new CGI::Simple; print qq{Content-type: text/html\n\r\n\r}; -if ($q->path_info() eq '/snippet') { +my $config = LoadFile('config.yml'); -print qq{ - - - - - - - -
-
- -
+ return $out; -
+} + +if ($q->path_info() eq '/snippet') { + + print get_results( + search => $q->param('search'), + page => $q->param('page'), + ); - -}; } else { - sub page_id { - my $page_id = time() . rand(99); - warn "page_id = $page_id\n"; - return $page_id; - }; + my $get_results = get_results( + search => $q->param('search'), + page => 1, + ); my $f = $q->path_info; $f =~ s/\W+//g; @@ -108,7 +169,7 @@ $f .= '.html'; open(my $s, $f) || die "$f: $!"; while(<$s>) { - s/<%(.*?)%>/eval "$1"/ge; + s/<%(.+?)%>/eval "$1"/ge; print; } close($f);