Flash-FLAP
view release on metacpan or search on metacpan
doc/examples/petmarket/petmarket/api/catalogservice.pm view on Meta::CPAN
package petmarket::api::catalogservice;
# Copyright (c) 2003 by Vsevolod (Simon) Ilyushchenko. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#This is server side for the Macromedia's Petmarket example.
#See http://www.simonf.com/flap for more information.
use warnings;
use strict;
use petmarket::api::dbConn;
use vars qw/@ISA/;
@ISA=("petmarket::api::dbConn");
use Flash::FLAP::Util::Object;
sub methodTable
{
return {
"getCategories" => {
"description" => "Returns list of categories",
"access" => "remote",
"returns" => "AMFObject"
},
"getProducts" => {
"description" => "Returns list of products",
"access" => "remote",
"returns" => "AMFObject"
},
"getItems" => {
"description" => "Returns list of items",
"access" => "remote",
"returns" => "AMFObject"
},
"searchProducts" => {
"description" => "Returns products whose name (or whose category's name) matches a string",
"access" => "remote",
"returns" => "AMFObject"
},
};
}
sub getCategories
{
my ($self) = @_;
my @result;
my $ary_ref = $self->dbh->selectall_arrayref("SELECT catid, name FROM category_details");
foreach my $rowRef (@$ary_ref)
{
my ($catid, $name) = @$rowRef;
my @row;
push @row, $catid;
push @row, $name;
push @row, lc $name;
push @row, "888888";
push @result, \@row;
}
my @columnNames = ("CATEGORYOID", "CATEGORYDISPLAYNAME", "CATEGORYNAME", "COLOR");
return Flash::FLAP::Util::Object->pseudo_query(\@columnNames, \@result);
}
( run in 3.986 seconds using v1.01-cache-2.11-cpan-98e64b0badf )