Akopia Akopia Services

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

Re: [mv] Row not found error in embedded perl.



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

On Tue, Jun 27, 2000 at 12:17:14PM -0400, Chris Rapier wrote:
> ******    message to minivend-users from Chris Rapier <rapier@psc.edu>     ******
> 
> I'm using some embedded perl to snag information out of a database so I
> can build clickbars dynamically. 
> 
> For the most part this works fine but if $rowname doesn't actually exist
> I get the following error:
> 
> 128.182.61.60 GBc4HGg7:128.182.61.60 - [27/June/2000:12:10:10 -0400]
> windfallfoods
> /cgi-bin/windfallfoods/scan/un=yes/sf=code/se="organic"/va=category_name=Organic
> Foods/tf=description,brand/ml=5.html Safe: There is no row with index
> 'organic' at /usr/home/rapier/mvend/lib/Vend/Table/Common.pm line 243.
> > 
> > 
> > my $ref = $Db{'catopts'};
> > my $vendurl = $Config->{'VendURL'};
> > my $colname="subcats";
> > my $build_html = "";
> > my $rowname = Values->{'mv_searchspec'}[0];
> > my $searches = $ref->field($rowname, $colname);
> > my @subcats = split /\,/, $searches;
> > foreach (@subcats) {
> > $build_html .= "<a href=\"$vendurl/scan/sf=category,subcat,category2,subcat2/se=$search/se=$_/os=no/ml=5.html/tf=description,brand\"><img src = \"/windfallfoods/images/$_.gif\"></a>";
> > }
> > return "$build_html";
> > 
> > 
> 128.182.61.60 GBc4HGg7:128.182.61.60 - [27/June/2000:12:10:10 -0400]
> windfallfoods
> /cgi-bin/windfallfoods/scan/un=yes/sf=code/se="organic"/va=category_name=Organic
> Foods/tf=description,brand/ml=5.html Runtime error: Can't call method
> "open_table" on an undefined value at
> /usr/home/rapier/mvend/lib/Vend/Data.pm line 762.
> 
> The problem is specifically with 
> my $searches = $ref->field($rowname, $colname);
> 
> I know I could do another query against a special row containing the
> names of all the rows and then seeing if $rowname is in that set but it
> seems a little inelegant.
> 
> Does anyone see a way around this?

my $rowname = Values->{'mv_searchspec'}[0];
return 'Bad row to hoe' unless(defined($rowname) && ($rowname ne ''));

-- 

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: