Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Efficient [perl] Results page



******    message to minivend-users from cfm@maine.com     ******

On Sat, Jul 29, 2000 at 02:26:22PM -0400, Handytman@aol.com wrote:
> ******    message to minivend-users from Handytman@aol.com     ******
> 
> I have seen statements on this list, indicating that the least CPU-intensive 
> way to display search results is to write the page in perl.

...
 
> What I've got so far is a results page which has all the [search-list] 
> display stuff in perl tags. (Actually, I use [calc] tags.) This results in 
> one perl call per item. Since the page is called to display eight items per 
> page, that means eight perl calls per page.
> It occurs to me that one perl call per page would be better. I'm asking:
> 
> 
> How can one perl call display all the items on the results page, eliminating 
> the need for [search-list][/search-list] tags?

This is an example from archives of a three year old site.  It's since
been overhauled, but it does show everything in one place and the perl is...
<AHEM>readable - say no more please!</AHEM>.  I'm not even sure
if [sql] tags are still around?

Mike H says you only win if you jump to perl very few times, way less than <8 is my
understanding.

This also illustrates what I meant in recent email that minivend is not "proceedural".
The entire result set has to be here for this approach; you can't go back for more 
based on the outcome of various routines.  (You can get around that by calling the libraries.)

Ugh, now I'm going to go erase that archive.  How embarrassing... ;^)

cfm


<TABLE ALIGN=CENTER>
<TR><TH COLSPAN=4>Searching for:</TH></TR>
<TR><TH>Published</TH><TH>Title</TH><TH>Author</TH><TH>Description</TH></TR>
<TR><TD>[value s_published]</TD><TD>[value s_title]</TD><TD>[value s_author]</TD><TD>[value s_description]</TD></TR>
</TABLE>

[embed]
	my (@OUT,$ary,$i,$string);
$string=<<'EOF';
[sql array] SELECT products.code,aux.published,products.product,authors_in_stock.author FROM products,aux,authors_in_stock WHERE aux.code=products.code AND authors_in_stock.code=products.code AND authors_in_stock.author LIKE '%[value s_author]%' AND aux.published LIKE '%[value s_published]%' AND products.product LIKE '%[value s_title]%' ORDER BY aux.published ASC [/sql]
EOF
        $ary = eval $string;
	push @OUT,'<TABLE ALIGN=CENTER CELLPADDING=0 CELLSPACING=0 WIDTH="90%">';
	push @OUT,'<TR><TH>Published</TH><TH>Title</TH><TH>Author</TH></TR>';
	if ( @$ary == 0 ) {
		push @OUT,'<TR><TD>There seems to be no match for your query</TD></TR>';
	} else {
	        foreach $i ( @$ary ) {
			my(%v);
			($v{'code'},$v{published},$v{product},$v{author})=@{$i};
			{
				if ( $v{product} =~ s/\|/, / ) {
					$v{product} =~ s/,\s?(THE|A)$//i;
					$v{product}="$1 $v{product}";
				}
			}
			push @OUT,"<TR><TD>$v{published}</TD><TD>[page $v{'code'}] $v{product} [/page]</TD><TD>$v{author}</TD></TR>";
		}
	}
	push @OUT,'</TABLE>';
	return "@OUT";
[/embed]



-- 

Christopher F. Miller, Publisher                             cfm@maine.com
MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
1.207.657.5078                                       http://www.maine.com/
Database publishing, e-commerce, office/internet integration, Debian linux.
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: