[Melbourne-pm] Ext.Direct

scottp at dd.com.au scottp at dd.com.au
Mon Aug 24 17:21:23 PDT 2009

Hey Dudes 

For those who use ExtJS 3.0, the new Direct (basically RPC) is excellent, but there was no Perl backend. Now there is: 


It is pretty basic. There is a simple CGI version and a modperl version. 


I have only spent a few hours on it so far, so there is hardly any testing, a few features missing and no security. Currently it is good as a reference implementation, but I am working on two CPAN releases: RPC::ExtDirect - a perl module useful for calling from CGI. I would also like to use that (directly or as a reference) for a Catalyst module or similar. AND Apache::RPC::ExtDirect which is currently fully working, including preloading of classes (& optional instantiation), but still needs documentation, more testing and better configuraiton before release. 

So a quick how do you use it? 

Write your module 
package RealDemo; 
use JSON; 
sub doTest { 
my ($class, $in) = @_; 
if ($in =~ /cott/) { 
return "You can not use 'Scott' in your name"; 
return JSON::true; 
Write your configuration file: 
Demo => { 
Class => 'RealDemo', 
Methods => { 
doTest => { params => 1 }, 
Load your apache config 
PerlModule Apache::RPC::ExtDirect 
<Location /data> 
SetHandler modperl 
PerlResponseHandler Apache::RPC::ExtDirect 
After loading your javascript, you can just call the method. 
Demo.doTest('Call the function'); 
but you need a callback to get the results. 
Demo.doTest('Call the function', function(result) { 
alert("We got: " + result); 


scottp at dd.com.au 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20090824/d1257e5b/attachment.html>

More information about the Melbourne-pm mailing list