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("got params: " . Dumper( $params ) ); |
36 |
|
37 |
my $q; |
38 |
my @attr; |
39 |
|
40 |
foreach my $f (keys %{ $params }) { |
41 |
next unless ($params->{$f}); |
42 |
next if ($f =~ m/^_/o); |
43 |
push @attr, $f; |
44 |
$q .= $params->{$f} . " "; |
45 |
} |
46 |
|
47 |
$c->stash->{results} = sub { |
48 |
my $res = $webpac->search( $q ); |
49 |
$log->debug("results are: " . join(",", $res)); |
50 |
return $res; |
51 |
}; |
52 |
|
53 |
$c->stash->{template} = 'results.tt'; |
54 |
} |
55 |
|
56 |
=back |
57 |
|
58 |
|
59 |
=head1 AUTHOR |
60 |
|
61 |
Dobrica Pavlinusic,,, |
62 |
|
63 |
=head1 LICENSE |
64 |
|
65 |
This library is free software, you can redistribute it and/or modify |
66 |
it under the same terms as Perl itself. |
67 |
|
68 |
=cut |
69 |
|
70 |
1; |