AMF-Perl
view release on metacpan or search on metacpan
doc/code.html view on Meta::CPAN
A:link { color: #3366AA; text-decoration: none; }
A:visited { color: #3366CC; text-decoration: none; }
A:active { color: #00CC99; text-decoration: none; }
A:hover { color: #FFFFFF; text-decoration: none; background-color: #6699CC; }
A.noDec:link { color: #000099; font-weight: bold; text-decoration: none; }
A.noDec:visited { color: #000099; font-weight: bold; text-decoration: none; }
A.noDec:active { color: #000099; font-weight: bold; text-decoration: none; }
A.noDec:hover { color: #3366AA; font-weight: bold; text-decoration: underline; background-color: transparent; }
A.plain:link { color: #000033; text-decoration: none; }
A.plain:visited { color: #000033; text-decoration: none; }
A.plain:active { color: #000033; text-decoration: none; }
A.plain:hover { color: #3366AA; text-decoration: none; background-color: transparent; }
h2 {
color: #333333;
font-size: 20 px;
font-weight: bold;
}
h3 {
color: #333333;
font-size: 18 px;
font-weight: bold;
}
h4 {
color: #0066CC;
font-size: 14px;
font-weight: bold;
}
</style>
</head>
<body
style="background-image: url(orn5.gif);">
<div style="position: absolute; left: 20px;">
<h1>AMF::Perl - Flash Remoting in Perl and Python<br>
</h1>
<table cellpadding="2" cellspacing="2" border="0"
style="text-align: left; width: 600px;">
<tbody>
<tr>
<td style="vertical-align: top;"><big><span
style="font-weight: bold;">To use AMF::Perl, download it
and install in the usual way (perl Makefile.PL; make; make install).<br><br>
To build/export .swf files with "Flash Remoting" you need to install
<a href=http://www.macromedia.com/software/flashremoting/downloads/components/>
Flash Remoting MX Components </a> (free download).
This will install the files "NetServices.as" and "NetDebug.as" that are
used in the ActionScript.
</span></big><br>
<hr style="width: 100%; height: 2px;"><big><span
style="font-weight: bold;"></span></big>
<h2>Sample code that uses Flash Remoting <br>
</h2>
(See also examples that are distributed with the module).
<br>
<a href=encoding.html>Read this</a> if you want to send and receive strings in non-English encodings.
<br><br>
Client code:<br>
<br>
<textarea cols=50 rows=30>
//Obligatory includes
#include "NetServices.as"
#include "NetDebug.as"
//Get a connection object
NetServices.setDefaultGatewayURL("http://host/cpu.pl");
connection = NetServices.createGatewayConnection();
//Get a pointer to a service
remoteService = connection.getService("Foo", this);
//Call a remote method on that service
remoteService.bar();
//or... send arguments to the server:
remoteService.bar(arg1, arg2);
//This callback function will be invoked
function bar_result(value)
{
//do something with the value
}
</textarea>
<br>
<h3> Server code, option A - service registration.</h3><br>
Use in simple applications.<br>
<table>
<tr><th>Perl</th><th>Python</th></tr>
<tr>
<td valign=top>
<textarea cols=50 rows=40>
use AMF::Perl;
package Foo;
sub new
{
my ($proto)=@_;
my $self={};
bless $self, $proto;
return $self;
}
sub bar
{
my ($self, $arg1, $arg2) = @_;
my $value;
#Compute a return value
#...
return $value;
}
#Create the gateway object
( run in 0.547 second using v1.01-cache-2.11-cpan-3d66aa2751a )