AMF-Perl
view release on metacpan or search on metacpan
doc/examples/petmarket/petmarket/api/cartservice.pm view on Meta::CPAN
my @cards = ("American Express", "Discover/Novus", "MasterCard", "Visa");
return \@cards;
}
sub getShippingMethods
{
my @columns = ("shippingoid", "shippingname", "shippingdescription", "shippingprice", "shippingdays");
my @names = ("Ground", "2nd Day Air", "Next Day Air", "3 Day Select");
my @descriptions = (
"Prompt, dependable, low-cost ground delivery makes Ground an excellent choice for all your routine shipments. Ground reaches every address throughout the 48 contiguous states.",
"2nd Day Air provides guaranteed on-time delivery to every address throughout the United States (excluding intra-Alaska shipments) and Puerto Rico by the end of the second business day. This service is an economical alternative for time-sensi...
"Next Day Air features fast, reliable delivery to every address in all 50 states and Puerto Rico. We guarantee delivery by 10:30 a.m., noon, or end of day the next business day depending on destination (noon or 1:30 p.m. on Saturdays).",
"The ideal mix of economy and guaranteed on-time delivery, 3 Day Select guarantees delivery within three business days to and from every address in the 48 contiguous states."
);
my @prices = (13.00, 26.00, 39.00, 18.00);
my @days = (6, 2, 1, 3);
my @methods;
for (my $i = 0; $i < scalar @names; $i++)
{
lib/AMF/Perl/App/Executive.pm view on Meta::CPAN
=cut
use strict;
use AMF::Perl::Util::RemotingService;
#The above variable declarations are not needed, as hash keys are used. They are useful just for the comments.
# the directory which should be used for the basic packages default "../"
# my $_basecp = "../";
# the classpath which is the path of the file from $_basecp
#my $_classpath;
# the string name of the package derived from the classpath
#my $_classname;
# the object we build from the package
#my $_classConstruct;
# the method to execute in the construct
#my $_methodname;
# the defined return type
#my $_returnType;
# the instance name to use for this gateway executive
lib/AMF/Perl/App/Executive.pm view on Meta::CPAN
# setter for the _headerFilter
sub setHeaderFilter
{
my ($self, $header) = @_;
$self->{_headerFilter} = $header;
}
# Set the base classpath. This is the path from which will be search for the packagees and functions
# $basecp should end with a "/";
sub setBaseClassPath
{
my ($self, $basecp) = @_;
$self->{_basecp} = $basecp;
}
sub setInstanceName
{
my ($self, $name) = @_;
$self->{_instanceName} = $name;
}
# you pass directory.script.method to this and it will build
# the classpath, classname and methodname values
lib/AMF/Perl/App/Executive.pm view on Meta::CPAN
my $calledMethod = $method;
if(exists $self->{services}->{$package})
{
return $self->doMethodCall_registered($package, $method, $a);
}
#Otherwise, browse in the directory specified by the user.
push @INC, $self->{_basecp};
# build the class object
$package =~ s#\.#::#g;
unless (eval ("require " . $package))
{
# report back to flash that the class wasn't properly formatted
print STDERR "Class $package does not exist or could not be loaded.\n";
print STDERR $@;
lib/AMF/Perl/IO/Deserializer.pm view on Meta::CPAN
{
my ($self)=@_;
my $s = $self->{inputStream}->readUTF();
from_to($s, "utf8", $self->{encoding}) if $self->{encoding};
return $s;
}
sub readDate
{
my ($self)=@_;
my $ms = $self->{inputStream}->readDouble(); # date in milliseconds from 01/01/1970
# nasty way to get timezone
my $int = $self->{inputStream}->readInt();
if($int > 720)
{
$int = -(65536 - $int);
}
my $hr = floor($int / 60);
my $min = $int % 60;
my $timezone = "GMT " . -$hr . ":" . abs($min);
# end nastiness
# is there a nice way to return entire date(milliseconds and timezone) in PHP???
return $ms;
}
# XML comes in as a plain string except it has a long displaying the length instead of a short?
sub readXML
{
my ($self)=@_;
# reads XML
my $rawXML = $self->{inputStream}->readLongUTF();
from_to($rawXML, "utf8", $self->{encoding}) if $self->{encoding};
lib/AMF/Perl/IO/Serializer.pm view on Meta::CPAN
$self->{out}->writeLongUTF($d);
}
# must be used PHPRemoting with the service to set the return type to date
# still needs a more in depth look at the timezone
sub writeDate
{
my ($self, $d)=@_;
# write date code
$self->{out}->writeByte(11);
# write date (milliseconds from 1970)
$self->{out}->writeDouble($d);
# write timezone
# ?? this is wierd -- put what you like and it pumps it back into flash at the current GMT ??
# have a look at the amf it creates...
$self->{out}->writeInt(0);
}
# write a number formatted as a double with the bytes reversed
# this may not work on a Win machine because i believe doubles are
# already reversed, to fix this comment out the reversing part
( run in 1.340 second using v1.01-cache-2.11-cpan-39bf76dae61 )