Ace::B...chSubs(3pm)

πŸ’– Ace::Browser::SearchSubs β€” the manual page, bestie edition ✨

okay so you found the man page for Ace::Browser::SearchSubs(3pm) β€” that's the Perl doc you're holding, and it's literally the toolkit for writing search scripts in AceBrowser. The (3pm) just means "perl module, section 3, we're fancy like that". Let's go πŸ¦‹


✨ NAME ✨

Ace::Browser::SearchSubs β€” subroutines for AceBrowser search scripts. That's the whole vibe. It's the plug-in that makes your search pages pop off πŸ’…


🌸 SYNOPSIS 🌸

Here's the little taste test, verbatim, no notes:

use Ace;
use Ace::Browser::AceSubs;
use Ace::Browser::SearchSubs;
use CGI qw(:standard);

my $form = p(start_form,
             textfield(-name=>'query'),
             end_form);
AceSearchTable('Search for stuff',$form);
...

my $query  = param('query');
my $offset = AceSearchOffset;
my ($objects,$count) = do_search($query,$offset);
AceResultsTable($objects,$count,$offset,'Here are results');

see how it flows?? build a form, hand it to AceSearchTable, grab the params, search, then dump it all into AceResultsTable. chef's kiss πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

So Ace::Browser::SearchSubs exports a little bundle of constants and subroutines β€” and bestie, they are everything when you're building AceBrowser search scripts. Ready?

πŸŽ€ CONSTANTS πŸŽ€

This package exports the following constants:

  • MAXOBJECTS β€” the maximum number of objects that can be displayed per page. Like, the ceiling. Don't exceed it, iykyk.
  • SEARCH_ICON β€” an icon to use for search links. ⚠️ heads up: this is deprecated. Use Configuration->Search_icon instead. it's giving "old news", we moved on πŸ’€

πŸ”₯ FUNCTIONS πŸ”₯

These functions are exported:

  • $offset = AceSearchOffset() β€” when the user is paging back and forth among a multi-page list of results, this function returns the index of the first item to display. that's it, that's the job. it's the "where do I start counting" guy 🫢
  • AceSearchTable([{hash}],$title,@contents) β€” give it a title plus some HTML contents, and it formats the search into a table, paints it with the same background and foreground colors used elsewhere for searches, and then prints the formatted search out. The HTML contents are usually a fill-out form. For convenience, you can hand over the contents in multiple parts (lines or elements) and they'll all get concatenated together. And if that first argument is a hashref, its contents get passed to start_form() to override the form arguments. so flexible, so iconic ✨
  • AceResultsTable($objects,$count,$offset,$title) β€” this subroutine formats the results of a search into a pageable list and prints out the resulting HTML. The following arguments are required:
    • $objects β€” an array reference containing the objects to place in the table.
    • $count β€” the total number of objects.
    • $offset β€” the offset into the array, as returned by AceSearchOffset()
    • $title β€” a title for the table.
🚨 important: the array reference should contain no more than MAXOBJECTS objects, and the AceDB query should be arranged in such a way that this is the case. don't be the main character who ignores this, bestie.

A typical idiom is the following:

my $offset = AceSearchOffset();
my $query  = param('query');
my $count;
my @objs = $db->fetch(-query=> $query,
                      -count  => MAXOBJECTS,
                      -offset => $offset,
                      -total => \$count
                     );
AceResultsTable(\@objs,$count,$offset,'Here are the results');

look at that -total => \$count sneaking the count in by reference. slay πŸ“


πŸ› BUGS πŸ›

Please report them. (yes, that's the whole section. short and honest, we love that for them. if you find one, go tell somebody πŸ’–)


🌈 SEE ALSO 🌈

  • Ace::Object
  • Ace::Browser::SiteDefs
  • Ace::Browsr::AceSubs
  • the README.ACEBROWSER file

(and yes, Ace::Browsr::AceSubs is spelled exactly like that in the original β€” we do not correct the ancestors πŸ’…)


πŸ‘‘ AUTHOR πŸ‘‘

Lincoln Stein <lstein@cshl.org>.

Copyright (c) 2001 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.


aaaand that's the whole page, no cap 🌸 this absolute classic of a doc is perl v5.42.3, dated 2026-08-19, from that Ace::B...chSubs(3pm) corner of the man pages. go forth and write search scripts, you gorgeous nerd, ily πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from