[Bio] / FigWebServices / SearchSkeleton.cgi Repository:
ViewVC logotype

Annotation of /FigWebServices/SearchSkeleton.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (view) (download)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     BEGIN {
4 :     # Print the HTML header.
5 :     print "CONTENT-TYPE: text/html\n\n";
6 :     }
7 :    
8 : parrello 1.10 use strict;
9 :     use Tracer;
10 :     use CGI;
11 :     use Sprout;
12 :     use SearchHelper;
13 :     use POSIX qw(ceil);
14 :     use File::stat;
15 :    
16 :     # Add USE statements for new search helpers below.
17 :     use SHFidSearch;
18 :     use SHBlastSearch;
19 :     use SHSigGenes;
20 :     use SHWordSearch;
21 :     use SHPropSearch;
22 :     use SHDrugSearch;
23 : parrello 1.12 use SHSubSearch;
24 : parrello 1.10
25 : parrello 1.1 =head1 NMPDR Search Skeleton
26 :    
27 :     This script executes a search and displays the results. If, on entry,
28 :     it sees a session ID, then it will assume search results have been
29 :     cached and the cached results are to be displayed. Otherwise, it
30 :     will perform the search, cache the results, and display the first
31 :     page. The search itself is performed by an object that subclasses
32 :     B<SearchHelper>. To allow for additional search types, you need
33 :     merely implement a new subclass of B<SearchHelper> and add it
34 :     to the C<use> list below. By convention, all search helper
35 :     subclasses begin with the letters C<SH>. This is not consistent
36 :     with normal PERL practice, but it fits better into the way we
37 :     do builds.
38 :    
39 :     =head2 Session Data
40 :    
41 :     The following parameters are expected from the CGI query object.
42 :     Additional parameters may be required by whichever B<SearchHelper>
43 :     subclass is selected. By convention, the parameters required by
44 :     the subclasses will be lower-case and the parameters used by this
45 :     script are capital-case. Note that some parameters are only required
46 :     by old sessions, that is, sessions which are established with
47 :     existing search result cache files.
48 :    
49 :     =over 4
50 :    
51 :     =item Trace
52 :    
53 :     Trace level and list of trace modules to turn on, space-delimited.
54 :    
55 :     =item NoForm
56 :    
57 :     If specified, then no search form will be generated.
58 :    
59 :     =item SessionID
60 :    
61 :     Unique session ID for this user. This is used to generate the name of the user's
62 :     cache file in the temporary directory. The actual filename will be
63 :     C<tmp_>I<SessionID>C<.cache>.
64 :    
65 :     =item Page (old only)
66 :    
67 :     Number of the current page to display.
68 :    
69 :     =item PageSize
70 :    
71 :     Number of items per page.
72 :    
73 :     =item ResultCount (old only)
74 :    
75 :     Total number of search result lines.
76 :    
77 :     =item Class
78 :    
79 :     Name of the B<SearchHelper> subclass for this type of search. The name does not include
80 :     the C<SH> prefix. So, to specify a B<SHFidSearch> type of
81 :     search, you would specify a class of C<FidSearch>. If this parameter is omitted,
82 :     then all of the advanced search forms will be displayed.
83 :    
84 : parrello 1.3 =item ShowURL
85 :    
86 :     If specified, then a URL for repeating the search will be shown as a hyperlink on the
87 :     results page.
88 :    
89 :     =item ShowAliases
90 :    
91 :     If specified, then hyperlinked aliases will be shown for each feature.
92 :    
93 : parrello 1.12 =item Alternate
94 :    
95 :     If specified, then a list of advanced search forms will be shown.
96 :    
97 : parrello 1.1 =back
98 :    
99 :     =head2 The Cache File
100 :    
101 :     The cache file is a tab-delimited file. The first line of the file contains the
102 :     column names and the remaining lines contain the data for each result item.
103 :    
104 :     The column contents may contain HTML tags, including hyperlinks and buttons. For best
105 :     results, all links should be relative.
106 :    
107 : parrello 1.3 Some columns will consist of a doubled percent sign followed by a name, an equal sign,
108 :     and some text. This tells the display code to call the B<RunTimeColumns> method of
109 :     the B<SearchHelper> object to compute the column value. This facility is designed for
110 :     columns that require a lot of time to calculate, so we don't want to calculate them
111 :     until we absolutely have to display them.
112 :    
113 : parrello 1.1 It is presumed that the cache file is small, containing no more than a few thousand
114 :     lines of data. If this is not the case, an entirely different strategy will be
115 :     needed for displaying search results.
116 :    
117 :     If the cache file is empty or has only a single line, a stock "No Search Results"
118 :     message will be displayed.
119 :    
120 :     =cut
121 :    
122 :    
123 :     my ($cgi, $varHash) = ScriptSetup();
124 :     eval {
125 :     # Get the search class.
126 :     my $class = $cgi->param("Class");
127 : parrello 1.11 # Check for advanced mode.
128 :     if ($cgi->param("Alternate")) {
129 : parrello 1.12 Trace("Advanced mode selected.") if T(3);
130 :     # In advanced mode, we list all the search forms listed in
131 :     # $FIG_Config::advanced_class.
132 :     my @classes = split(/\s+/, $FIG_Config::advanced_class);
133 :     # Set the page size to the default.
134 :     $cgi->param(-name => 'PageSize', -value => $FIG_Config::results_per_page);
135 :     # Tell the template we have no search results and no class.
136 :     $varHash->{result_count} = 0;
137 :     $varHash->{class} = "";
138 : parrello 1.13 # Loop through the classes, creating the table of contents and
139 :     # the forms.
140 :     $varHash->{formIndex} = $cgi->h3("Contents") . $cgi->start_ul();
141 : parrello 1.12 for my $className (@classes) {
142 :     my $shelp = GetHelper($cgi, $className);
143 : parrello 1.13 # Produce the contents entry.
144 :     $varHash->{formIndex} .= $cgi->li($cgi->a({href => "#X$className"}, $className) .
145 :     ": " . $shelp->Description());
146 :     # Produce the bookmark.
147 :     $varHash->{form} .= $cgi->a({ name => "X$className" });
148 : parrello 1.12 # Produce the form.
149 :     $varHash->{form} .= $shelp->Form();
150 :     # Produce the help text.
151 :     $varHash->{form} .= $shelp->GetHelpText();
152 :     # Put some space between us and whatever comes next.
153 :     $varHash->{form} .= "<p>&nbsp;</p>";
154 :     }
155 : parrello 1.13 # Close the table of contents.
156 :     $varHash->{formIndex} .= $cgi->end_ul();
157 : parrello 1.12 } elsif (! $class) {
158 : parrello 1.2 Trace("Producing index of search tools.") if T(3);
159 :     # No class specified, so we simply generate an index of the
160 :     # searches. First, make sure the template knows there are no search results.
161 : parrello 1.1 $varHash->{result_count} = 0;
162 : parrello 1.2 Trace("Building URL.") if T(3);
163 :     # Get a copy of our URL. Note we include the query fields so that any
164 :     # tracing parameters are preserved.
165 :     my $selfURL = $cgi->url(-relative => 1, -query => 1);
166 : parrello 1.4 # Append a question mark or semicolon to the URL, depending on whether or not
167 : parrello 1.2 # there's already a question mark present.
168 : parrello 1.4 $selfURL .= ($selfURL =~ /\?/ ? ';' : '?');
169 : parrello 1.2 # Loop through the search classes building a table of contents.
170 : parrello 1.1 my @contents = ();
171 : parrello 1.5 for my $className (SearchHelper::AdvancedClassList()) {
172 : parrello 1.2 Trace("Processing $className") if T(3);
173 : parrello 1.1 my $shelp = GetHelper($cgi, $className);
174 : parrello 1.2 push @contents, "<a href=\"${selfURL}Class=$className\">$className</a>: " . $shelp->Description();
175 : parrello 1.1 }
176 :     # Create the table of contents.
177 : parrello 1.2 Trace("Building index.") if T(3);
178 :     my $index = $cgi->h3("Index of Search Tools") .
179 : parrello 1.1 $cgi->ul($cgi->li(\@contents));
180 : parrello 1.11 # Store it as the results.
181 :     $varHash->{results} = $index;
182 : parrello 1.2 # Tell the template we don't have a class.
183 :     $varHash->{class} = "";
184 :     Trace("Index built.") if T(3);
185 : parrello 1.1 } else {
186 : parrello 1.2 Trace("Class $class detected.") if T(3);
187 : parrello 1.1 # Here we have a class, so we're working with a single type of search.
188 :     my $shelp = GetHelper($cgi, $class);
189 : parrello 1.2 # Tell the template what the class is.
190 :     $varHash->{class} = $class;
191 : parrello 1.3 # Insure we have a page size.
192 :     if (! $cgi->param("PageSize")) {
193 :     $cgi->param(-name => 'PageSize', -value => $FIG_Config::results_per_page);
194 :     }
195 : parrello 1.1 # Display the form, if desired.
196 : parrello 1.3 my $formShown = ! $cgi->param("NoForm");
197 :     if ($formShown) {
198 : parrello 1.9 Trace("Displaying form.") if T(3);
199 : parrello 1.1 $varHash->{form} = $shelp->Form();
200 :     }
201 : parrello 1.3 # Declare the result count variable.
202 :     my $result_count = 0;
203 : parrello 1.1 # Now there are three different directions we can go. If a
204 :     # "Search" button has been pressed, then we need to perform a
205 :     # search. If this is a new session and the button has not
206 :     # been pressed, we do nothing. If this is an old session
207 :     # and the button has not been pressed, we display results. Note
208 :     # that we allow for regular buttons (Search) or image buttons
209 :     # (Search.x).
210 :     if (!$cgi->param("Search") && !$cgi->param("Search.x")) {
211 :     # No button, so check for results. If this is a new session, we do
212 :     # nothing. The form is displayed and nothing else need be done.
213 : parrello 1.7 # Otherwise, we go into display-results mode.
214 : parrello 1.1 Trace("No search requested.") if T(3);
215 :     if (! $shelp->IsNew()) {
216 :     $varHash->{results} = DisplayResults($shelp, $cgi);
217 :     }
218 :     } else {
219 :     # Here we have a button press, so we need to find stuff and
220 : parrello 1.3 # then display it..
221 : parrello 1.1 Trace("Performing the search.") if T(3);
222 : parrello 1.3 # Clear the result area.
223 :     $varHash->{results} = "";
224 :     # Now we process the showURL thing. If showURL is checked, then
225 : parrello 1.4 # we will display a hyperlink to this search. Note that we only
226 :     # do it if the form was shown. If the form was not shown, the
227 :     # code for computing the URL won't work.
228 :     if ($cgi->param('ShowURL') && $formShown) {
229 : parrello 1.3 my $searchURL = $shelp->ComputeSearchURL();
230 :     $varHash->{results} .= $cgi->p("<a href=\"$searchURL\">Right-click to save a URL for this search</a>");
231 :     }
232 : parrello 1.4 # Perform the search.
233 : parrello 1.3 $result_count = $shelp->Find();
234 : parrello 1.1 # Check to see what kind of results we got.
235 : parrello 1.2 if (! defined($result_count)) {
236 : parrello 1.1 # Here an error occurred, so we display the error message.
237 : parrello 1.3 $varHash->{results} .= $cgi->h3("ERROR: " . $shelp->Message());
238 :     $result_count = 0;
239 : parrello 1.1 } elsif ($result_count == 0) {
240 :     # Here nothing matched.
241 : parrello 1.3 $varHash->{results} .= $cgi->h3("No match found.");
242 : parrello 1.1 } else {
243 :     # Here we have results. Save the result count and set up to display
244 :     # the first page of results.
245 :     $cgi->param(-name => "ResultCount", -value => $result_count);
246 :     $cgi->param(-name => "Page", -value => 1);
247 :     # Start with a message about how many matches we found.
248 :     my $countText = ($result_count == 1 ? "One match" : "$result_count matches");
249 : parrello 1.3 $varHash->{results} .= $cgi->h3("$countText found.");
250 : parrello 1.1 # Append the page display.
251 :     $varHash->{results} .= DisplayResults($shelp, $cgi);
252 :     }
253 :     }
254 :     # Save the result count so that the results helper text appears if it
255 :     # is needed. This text is in the template, but it's protected by a TMPL_IF
256 :     # on "result_count".
257 : parrello 1.3 $varHash->{result_count} = $result_count;
258 :     # If there are no results and the form was shown, add the help text. We are
259 :     # assuming that if the user got the search to work, he doesn't need help.
260 :     # In addition, if the form was not shown, a description of how to use it
261 :     # makes no sense.
262 :     if (! $result_count && $formShown) {
263 :     $varHash->{helptext} = $shelp->GetHelpText();
264 :     }
265 : parrello 1.1 }
266 :     };
267 :     if ($@) {
268 :     my $errorMessage = $@;
269 :     Trace("Script Error: $errorMessage") if T(0);
270 :     $varHash->{results} = $cgi->h3("Script Error: $errorMessage");
271 :     }
272 :     ScriptFinish("SproutSearch_tmpl.php", $varHash);
273 :    
274 :     =head3 DisplayResults
275 :    
276 :     C<< my $htmlText = DisplayResults($shelp, $cgi); >>
277 :    
278 :     Display the results of a search. A page of results will be displayed, along with links to get to
279 :     other pages. The HTML for the results display is returned.
280 :    
281 :     =over 4
282 :    
283 :     =item shelp
284 :    
285 :     Search helper object representing the search. The column headers and search rows will be
286 :     stored in the session file attached to it.
287 :    
288 :     =item cgi
289 :    
290 :     CGI query object for the current session. This includes the page number, size, and result
291 :     counts.
292 :    
293 :     =item RETURN
294 :    
295 :     Returns the HTML text for displaying the current page of search results.
296 :    
297 :     =back
298 :    
299 :     =cut
300 :    
301 :     sub DisplayResults {
302 :     # Get the parameters.
303 :     my ($shelp, $cgi) = @_;
304 :     # Declare the return variable.
305 :     my $retVal;
306 :     # Extract the result parameters.
307 :     my ($pageSize, $pageNum, $resultCount) = ($cgi->param('PageSize'),
308 :     $cgi->param('Page'),
309 :     $cgi->param('ResultCount'));
310 :     # Only proceed if there are actual results.
311 :     if ($resultCount <= 0) {
312 :     $retVal = $cgi->h3("No matches found.");
313 :     } else {
314 :     # Check the state of the session file.
315 :     my $fileName = $shelp->GetCacheFileName();
316 :     if (! -e $fileName) {
317 :     $retVal = $cgi->h3("Search session has expired. Please resubmit your query.");
318 :     } else {
319 :     # The file is here, so we can open it.
320 :     my $sessionH = Open(undef, "<$fileName");
321 : parrello 1.6 if (T(3)) {
322 :     my $fileData = stat($sessionH);
323 :     Trace($fileData->size . " bytes in $fileName.");
324 :     }
325 : parrello 1.1 # Read the column headers.
326 :     my @colHdrs = Tracer::GetLine($sessionH);
327 :     # Compute the page navigation string.
328 :     my $pageNavigator = PageNavigator($cgi);
329 :     # Now we need to find our page. The line number we compute will be
330 :     # zero-based. We'll read from the session file until it drops to zero.
331 :     # This may push us past end-of-file, but it won't cause an exception, and
332 :     # it's something that should only happen very rarely in any case.
333 : parrello 1.4 my $linesToSkip = ($pageNum - 1) * $pageSize;
334 :     Trace("Skipping $linesToSkip lines in session file $fileName.") if T(3);
335 :     for (my $lines = $linesToSkip; $lines > 0; $lines--) {
336 : parrello 1.1 Tracer::GetLine($sessionH);
337 :     }
338 :     # The session file is now positioned at the beginning of our line.
339 :     # We build the table rows one line at a time until we run out of data
340 :     # or exceed the page size.
341 :     my @tableRows = ();
342 :     my $linesLeft = $pageSize;
343 : parrello 1.5 Trace("$linesLeft lines to read from session file.") if T(3);
344 :     while ($linesLeft-- > 0) {
345 :     Trace("Reading line from session file.") if T(3);
346 :     my @cols = Tracer::GetLine($sessionH);
347 :     if (! @cols) {
348 :     Trace("End of file read.") if T(3);
349 :     $linesLeft = 0;
350 :     } else {
351 :     Trace("Line has " . scalar(@cols) . " columns. $linesLeft lines left.") if T(3);
352 :     # Check the columns for run-time generation.
353 :     my @actual = map { substr($_,0,2) eq "%%" ? $shelp->GetRunTimeValue($_) : $_ } @cols;
354 :     # Put the actual data into the table list.
355 :     push @tableRows, \@actual;
356 :     }
357 : parrello 1.1 }
358 :     # Now we're ready. We do a page navigator, a spacer, the table, a spacer,
359 :     # and another page navigator.
360 :     $retVal = join("\n", $pageNavigator,
361 :     $cgi->p("&nbsp;"),
362 : parrello 1.10 $cgi->h3("Search Results Page $pageNum"),
363 :     PageBuilder::MakeFancyTable($cgi, \@colHdrs, \@tableRows),
364 : parrello 1.1 $cgi->p("&nbsp;"),
365 :     $pageNavigator,
366 :     "");
367 :     }
368 :     }
369 :     # Return the result.
370 :     return $retVal;
371 :     }
372 :    
373 :     =head3 PageNavigator
374 :    
375 :     C<< my $htmlText = PageNavigator($cgi); >>
376 :    
377 :     Return a page navigation string for the specified query.
378 :    
379 :     =over 4
380 :    
381 :     =item cgi
382 :    
383 :     CGI query object for the current session. The key values are described in the
384 :     introduction to this document.
385 :    
386 :     =back
387 :    
388 :     =cut
389 :    
390 :     sub PageNavigator {
391 :     # Get the parameters.
392 :     my ($cgi) = @_;
393 :     # Extract the result parameters.
394 :     my ($pageSize, $pageNum, $resultCount) = ($cgi->param('PageSize'),
395 :     $cgi->param('Page'),
396 :     $cgi->param('ResultCount'));
397 : parrello 1.4 # Declare the return variable.
398 :     my $retVal = "";
399 : parrello 1.1 # Compute the number of the last page.
400 :     my $lastPage = ceil($resultCount / $pageSize);
401 : parrello 1.4 # Only proceed if there's more than one page.
402 :     if ($lastPage > 1) {
403 :     # Create a URL without a page number. All the other URLs will be generated
404 :     # from this one by appending the new page number.
405 :     my $url = StatusURL($cgi, Page => undef);
406 :     # Now compute the start and end pages for the display. We display ten pages,
407 :     # with the current one more or less centered.
408 :     my $startPage = $pageNum - 4;
409 :     if ($startPage < 1) { $startPage = 1; }
410 :     my $endPage = $startPage + 9;
411 :     if ($endPage > $lastPage) { $endPage = $lastPage; }
412 :     # Create a list of URL/page-number combinations.
413 :     my @pageThings = ();
414 :     for (my $linkPage = $startPage; $linkPage <= $endPage; $linkPage++) {
415 :     # Check for the current page. It gets a page number with no link.
416 :     if ($linkPage == $pageNum) {
417 :     push @pageThings, $linkPage;
418 :     } else {
419 :     # This is not the current page, so it gets the full treatment.
420 :     push @pageThings, PageThing($cgi, $linkPage, $linkPage, $url);
421 :     }
422 : parrello 1.1 }
423 : parrello 1.4 # Now add some jump links at the end.
424 :     my @forePointers = ();
425 :     if ($endPage < $lastPage) {
426 :     for (my $pg = $endPage + 5; $pg < $lastPage; $pg += 15) {
427 :     push @forePointers, PageThing($cgi, $pg, $pg, $url);
428 :     }
429 :     push @forePointers, PageThing($cgi, ">>", $lastPage, $url);
430 : parrello 1.3 }
431 : parrello 1.4 # Finally, add some jump links at the front.
432 :     my @backPointers = ();
433 :     if ($startPage > 1) {
434 :     for (my $pg = $startPage - 5; $pg > 1; $pg -= 15) {
435 : parrello 1.6 unshift @backPointers, PageThing($cgi, $pg, $pg, $url);
436 : parrello 1.4 }
437 : parrello 1.6 unshift @backPointers, PageThing($cgi, "<<", 1, $url);
438 : parrello 1.3 }
439 : parrello 1.4 # Put it all together.
440 :     my $middle = join(" ", @pageThings);
441 :     $retVal = join " ... ", @backPointers, $middle, @forePointers;
442 : parrello 1.3 }
443 : parrello 1.1 # Return the result.
444 :     return $retVal;
445 :     }
446 :    
447 :     =head3 PageThing
448 :    
449 :     C<< my $htmlText = PageThing($cgi, $pageLabel, $pageNumber, $url); >>
450 :    
451 :     Create an entry for the page navigator. The entry consists of a label that
452 :     is hyperlinked to the specified page number of the search results.
453 :    
454 :     =over 4
455 :    
456 :     =item cgi
457 :    
458 :     CGI object, used to access the CGI HTML-building methods.
459 :    
460 :     =item pageLabel
461 :    
462 :     Text to be hyperlinked. This is usually the page number, but sometimes it will be
463 :     arrows.
464 :    
465 :     =item pageNumber
466 :    
467 :     Number of the page to be presented when the link is followed.
468 :    
469 :     =item url
470 :    
471 :     Base URL for viewing a page.
472 :    
473 :     =item RETURN
474 :    
475 :     Returns HTML for the specified label, hyperlinked to the desired page.
476 :    
477 :     =back
478 :    
479 :     =cut
480 :    
481 :     sub PageThing {
482 :     # Get the parameters.
483 :     my ($cgi, $pageLabel, $pageNumber, $url) = @_;
484 :     # Compute the full URL.
485 :     my $purl = "$url&Page=$pageNumber";
486 :     # Form it into a hyperlink.
487 :     my $retVal = "<a href=\"$purl\" title=\"Results page $pageNumber\">$pageLabel</a>";
488 :     # Return the result.
489 :     return $retVal;
490 :     }
491 :    
492 :     =head3 StatusURL
493 :    
494 :     C<< my $queryUrl = StatusURL($cgi, %overrides); >>
495 :    
496 :     Create a URL for the current script containing status information for the search in progress.
497 :     The values in the incoming CGI object will be used for all parameters except the ones
498 :     specified as overrides. So, for example
499 :    
500 :     StatusURL($cgi, PageNum => 3)
501 :    
502 :     would specify a page number of 3, but all the other parameters will be taken as is from
503 :     the CGI object. The complete list of session variables is given in the L</Session Data>
504 :     section.
505 :    
506 :     =over 4
507 :    
508 :     =item cgi
509 :    
510 :     CGI query object containing the session variables.
511 :    
512 :     =item overrides
513 :    
514 :     A hash mapping key names to override values. These are used to override values in the
515 :     I<$cgi> parameter.
516 :    
517 :     =item RETURN
518 :    
519 :     Returns a relative URL for the current page with GET-style values for all the session
520 :     variables.
521 :    
522 :     =back
523 :    
524 :     =cut
525 :    
526 :     sub StatusURL {
527 :     # Get the parameters.
528 :     my ($cgi, %overrides) = @_;
529 :     # Create a hash of the session variables we want to keep.
530 :     my %varHash;
531 :     for my $varKey (qw(SessionID Trace NoForm ResultCount Page PageSize Class SPROUT)) {
532 :     # Check for an override.
533 :     if (exists $overrides{$varKey}) {
534 :     my $override = $overrides{$varKey};
535 :     # Use the override if it is not null or undefined.
536 :     if (defined($override) && $override ne "") {
537 :     $varHash{$varKey} = $override;
538 :     }
539 :     } else {
540 :     # Check for a CGI value.
541 :     my $normal = $cgi->param($varKey);
542 :     # Use it if it exists.
543 :     if (defined($normal)) {
544 :     $varHash{$varKey} = $normal;
545 :     }
546 :     }
547 :     }
548 :     # Compute the full URL.
549 :     my $retVal = Tracer::GenerateURL($cgi->url(-relative => 1), %varHash);
550 :     # Return the result.
551 :     return $retVal;
552 :     }
553 :    
554 :     =head3 GetHelper
555 :    
556 :     C<< my $shelp = GetHelper($className); >>
557 :    
558 :     Return a helper object with the given class name. If no such class exists, an
559 :     error will be thrown.
560 :    
561 :     =over 4
562 :    
563 :     =item cgi
564 :    
565 :     Active CGI query object.
566 :    
567 :     =item className
568 :    
569 :     Class name for the search helper object, without the preceding C<SH>. This is
570 :     identical to what the script expects for the C<Class> parameter.
571 :    
572 :     =item RETURN
573 :    
574 :     Returns a search helper object for the specified class.
575 :    
576 :     =back
577 :    
578 :     =cut
579 :    
580 :     sub GetHelper {
581 :     # Get the parameters.
582 :     my ($cgi, $className) = @_;
583 :     # Try to create the search helper.
584 :     my $retVal = eval("SH$className->new(\$cgi)");
585 :     if (! defined $retVal) {
586 :     Confess("Could not find a search handler of type $className.");
587 :     }
588 :     # Return the result.
589 :     return $retVal;
590 :     }
591 :    
592 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3