AMF-Perl
view release on metacpan or search on metacpan
doc/examples/petmarket/README.txt view on Meta::CPAN
There are a few steps to get it working - you need to compile each movie separately, for example.
To make thing easier, a fully precompiled client side is provided at the AMF::Perl web site:
http://www.simonf.com/amfperl/examples/petmarket/index.html
(Unlike other examples, the client is NOT included into the AMF::Perl distribution due to its size.)
2. Usage.
You need to load the data in petmarket.sql into a database and configure
the database server, name username and password in dbConn.pm.
You HAVE to set your server URL in initFunction/mainInit.as and then recompile main.fla in order to point your
client to your server.
3. Notes about implementation.
You HAVE to have these files in the directory petmarket/api relative to your Perl gateway script,
because this is what the Flash client assumes.
doc/examples/petmarket/petmarket.sql view on Meta::CPAN
INSERT INTO product_details VALUES ('FI-SW-02','en-US','Tiger Shark','fish4.gif','Salt Water fish from Australia');
INSERT INTO product_details VALUES ('FI-FW-01','en-US','Koi','fish3.gif','Fresh Water fish from Japan');
INSERT INTO product_details VALUES ('K9-CW-01','en-US','Chihuahua','dog4.gif','Great companion dog');
--
-- Table structure for table 'user_details'
--
CREATE TABLE user_details (
email varchar(50) default NULL,
password varchar(50) default NULL,
firstname varchar(50) default NULL,
lastname varchar(50) default NULL,
homestreet1 varchar(50) default NULL,
homestreet2 varchar(50) default NULL,
homecity varchar(50) default NULL,
homestate char(2) default NULL,
homecountry varchar(50) default NULL,
homezip varchar(10) default NULL,
homephone varchar(20) default NULL,
shippingstreet1 varchar(50) default NULL,
doc/examples/petmarket/petmarket/api/dbConn.pm view on Meta::CPAN
#This is server side for the Macromedia's Petmarket example.
#See http://www.simonf.com/amfperl for more information.
use warnings;
no warnings "uninitialized";
use strict;
my $dbhost = "localhost";
my $dbname = "database";
my $dbuser = "user";
my $dbpass = "password";
use DBI;
use AMF::Perl::Sql::MysqlRecordSet;
sub new
{
my ($proto) = @_;
my $self = {};
bless $self, $proto;
doc/examples/petmarket/petmarket/api/stringresourcesservice.pm view on Meta::CPAN
$strings{"NUMBER_SYMBOL_str"}="-";
$strings{"DATE_SEPARATOR_str"}="/";
$strings{"ADDRESS_LBL_str"}="Address:";
$strings{"CITY_LBL_str"}="City:";
$strings{"STATE_LBL_str"}="State:";
$strings{"ZIP_LBL_str"}="Zip / Postal Code:";
$strings{"EMAIL_LBL_str"}="E-mail:";
$strings{"PHONE_LBL_str"}="Phone:";
$strings{"CC_NUMBER_LBL_str"}="Credit Card Number:";
$strings{"CC_EXPIRATION_DATE_LBL_str"}="Expiration Date:";
$strings{"PROFILE_FLDS_HINT_str"}="If you're a new customer, please provide your email address and a password in order to create your account. Returning customers, log in using your email address and password.";
$strings{"PROFILE_FLDS_LOGOUT_1_HINT_str"}="You are currently logged in with the E-mail address: ";
$strings{"PROFILE_FLDS_LOGOUT_2_HINT_str"}="If this is not correct, you may log in to your existing account or create a new one.";
$strings{"PROFILE_FLDS_LOGOUT_EDIT_LBL_str"}="Edit";
$strings{"PASSWORD_LBL_str"}="Password:";
$strings{"PASSWORD_CONFIRM_LBL_str"}="Confirm Password:";
$strings{"CREATE_ACCOUNT_BTN_LBL_str"}="Create Account";
$strings{"LOGIN_BTN_LBL_str"}="Login";
$strings{"CONTINUE_BTN_LBL_str"}="Continue";
$strings{"NEW_CUSTOMER_TRUE_RB_LBL_str"}="New Customer";
$strings{"NEW_CUSTOMER_FALSE_RB_LBL_str"}="Returning Customer";
doc/examples/petmarket/petmarket/api/stringresourcesservice.pm view on Meta::CPAN
$strings{"CHARGE_SUMMARY_HINT_str"}="Please review all charges listed below before completing your purchase.\n\nMake sure that you have selected your preferred shipping method and entered any promotional codes that may entitle you to a discou...
$strings{"CHARGE_SUMMARY_SUBTOTAL_LBL_str"}="Cart Subtotal:";
$strings{"CHARGE_SUMMARY_PROMOTIONS_LBL_str"}="Promotions:";
$strings{"CHARGE_SUMMARY_SHIPPING_LBL_str"}="Shipping Charges:";
$strings{"CHARGE_SUMMARY_TAX_LBL_str"}="Taxes:";
$strings{"CHARGE_SUMMARY_GRAND_TOTAL_LBL_str"}="Total Charges:";
$strings{"VALIDATE_EMAIL_ERR_TITLE_str"}="E-mail not valid";
$strings{"VALIDATE_EMAIL_ERR_MSG_str"}="E-mail entered is not valid.\nPlease try again.";
$strings{"VALIDATE_PASS_ERR_TITLE_str"}="Password invalid";
$strings{"VALIDATE_PASS_MISMATCH_ERR_MSG_str"}="Passwords do not match.\nPlease try again.";
$strings{"VALIDATE_PASS_INVALID_ERR_MSG_str"}="Invalid password.\nPlease try again.";
$strings{"VALIDATE_CREATE_USER_FAILED_TITLE_str"}="Failed to create user";
$strings{"VALIDATE_CREATE_USER_FAILED_MSG_str"}="An account using this E-mail address already exists.";
$strings{"VALIDATE_LOGIN_USER_FAILED_TITLE_str"}="Failed to log in";
$strings{"VALIDATE_LOGIN_USER_FAILED_MSG_str"}="Unable to log in.\nPlease check the E-mail address and password and try again.";
$strings{"VALIDATE_FIRST_NAME_ERROR_MSG_str"}="Please type in your first name.";
$strings{"VALIDATE_FIRST_NAME_ERROR_TITLE_str"}="Invalid first name";
$strings{"VALIDATE_LAST_NAME_ERROR_MSG_STR"}="Please type in your last name.";
$strings{"VALIDATE_LAST_NAME_ERROR_TITLE_STR"}="Invalid last name";
$strings{"VALIDATE_ADDRESS_ERROR_MSG_str"}="Please type in an address.";
$strings{"VALIDATE_ADDRESS_ERROR_TITLE_str"}="Invalid address";
$strings{"VALIDATE_CITY_ERROR_MSG_str"}="Please type in a city.";
$strings{"VALIDATE_CITY_ERROR_TITLE_str"}="Invalid city";
$strings{"VALIDATE_ZIPCODE_ERROR_MSG_str"}="Please enter a valid 5 digit Zip code.";
$strings{"VALIDATE_ZIPCODE_ERROR_TITLE_str"}="Invalid Zip code";
doc/examples/petmarket/petmarket/api/userservice.pm view on Meta::CPAN
"access" => "remote",
},
};
}
my @userFields = ("firstname", "lastname", "homestreet1", "homestreet2", "homecity", "homestate", "homecountry", "homezip", "homephone", "creditcardnumber", "creditcardtype", "creditcardexpiry");
my @shippingFields = ("shippingstreet1", "shippingstreet2", "shippingcity", "shippingcountry", "shippingzip", "shippingphone");
my @fields = ("email", "password", @userFields, @shippingFields);
sub authenticate
{
my ($self, $email, $password) = @_;
my $ary_ref = $self->dbh->selectall_arrayref("SELECT count(*) FROM user_details where email='$email' AND password='$password'");
return $ary_ref->[0]->[0] > 0;
}
sub addUser
{
my ($self, $email, $password) = @_;
$self->dbh->do("INSERT INTO user_details set email='$email', password='$password'");
my $result = new AMF::Perl::Util::Object;
$result->{"useroid"} = $email;
$result->{"email"} = $email;
$result->{"password"} = $password;
return $result;
}
sub getUser
{
my ($self, $email, $password) = @_;
return 0 unless $self->authenticate($email, $password);
my $result = new AMF::Perl::Util::Object;
my $hash_ref = $self->dbh->selectall_hashref("SELECT * FROM user_details WHERE email='$email'", "email");
my $rowRef = $hash_ref->{$email};
foreach my $field (@fields)
{
$result->{$field} = $rowRef->{$field};
}
$result->{useroid} = $email;
return $result;
}
sub updateUser
{
my ($self, $userObject) = @_;
return 0 unless $self->authenticate($userObject->{"email"}, $userObject->{"password"});
my $setString = "";
my @setStringArray = map {"$_='".$userObject->{$_}."'"} @userFields;
$setString = join ",", @setStringArray;
$self->dbh->do("UPDATE user_details SET $setString");
return $userObject;
}
doc/examples/sql/parkservices/ParkService.pm view on Meta::CPAN
package ParkService;
use warnings;
use strict;
use AMF::Perl::Sql::MysqlRecordSet;
my $dbhost = "localhost";
my $dbname = "database";
my $dbuser = "user";
my $dbpass = "password";
use DBI;
sub new
{
my ($proto) = @_;
my $self = {};
bless $self, $proto;
my $dbh = DBI->connect("DBI:mysql:host=$dbhost:db=$dbname","$dbuser","$dbpass",{ PrintError=>1, RaiseError=>1 })
( run in 0.848 second using v1.01-cache-2.11-cpan-49f99fa48dc )