/[webpac2]/Webpacus/lib/Webpacus/Controller/Results.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /Webpacus/lib/Webpacus/Controller/Results.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 118 - (show annotations)
Wed Nov 23 21:52:30 2005 UTC (18 years, 5 months ago) by dpavlin
File size: 1308 byte(s)
 r9076@llin:  dpavlin | 2005-11-23 22:53:24 +0100
 split queries in separate ISTRINC based on whitespace

1 package Webpacus::Controller::Results;
2
3 use strict;
4 use warnings;
5 use base qw/Catalyst::Controller/;
6
7 =head1 NAME
8
9 Webpacus::Controller::Results - Display results from WebPAC
10
11 =head1 SYNOPSIS
12
13 See L<Webpacus>
14
15 =head1 DESCRIPTION
16
17 Catalyst Controller.
18
19 =head1 METHODS
20
21 =over 4
22
23 =item default
24
25 =cut
26
27 sub default : Private {
28 my ( $self, $c ) = @_;
29
30 my $webpac = $c->comp('Model::WebPAC');
31 my $params = $c->req->params;
32 my $log = $c->log;
33
34 use Data::Dumper;
35 $log->debug("results got params: " . Dumper( $params ) );
36
37 my $q;
38 my @attr;
39
40 foreach my $f (keys %{ $params }) {
41
42 next if ($f =~ m/^_/o);
43
44 my $v = $params->{$f} || next;
45
46 $q .= "$v ";
47
48 next if ($f eq 'all'); # don't add_attr for magic field all
49
50 if ($v !~ /\s/) {
51 push @attr, "$f ISTRINC $v";
52 } else {
53 map { push @attr, "$f ISTRINC $_"; } split(/\s+/, $v);
54 }
55 }
56
57 $c->stash->{html_results} = sub {
58 my $res = $webpac->search( $q, $params->{'_template'}, \@attr );
59 # $log->debug("controller got " . ( $#{$res} + 1 ) . " results for '$q' " . Dumper( $res ));
60 return $res;
61 };
62
63 $c->stash->{template} = 'results.tt';
64 }
65
66 =back
67
68
69 =head1 AUTHOR
70
71 Dobrica Pavlinusic,,,
72
73 =head1 LICENSE
74
75 This library is free software, you can redistribute it and/or modify
76 it under the same terms as Perl itself.
77
78 =cut
79
80 1;

  ViewVC Help
Powered by ViewVC 1.1.26