Developing Rich Internet Applications with Perl and JavaScript

3,707 views
3,621 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,707
On SlideShare
0
From Embeds
0
Number of Embeds
674
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Developing Rich Internet Applications with Perl and JavaScript

  1. 1. Developing Rich InternetApplications with Perl and JavaScript San Diego.pm talk Apr 19 2012
  2. 2. Web application evolution• Once upon a time, there was a static page• Then came CGI scripts• Then came client side scripting• Then came AJAX and asynchronous calls• What next?
  3. 3. Introducing RIA• One possible answer: RIAs• Stands for: Rich Internet Applications• Many ways to develop, many frameworks• I have been exploring Ext JS framework for JavaScript
  4. 4. How does it work?• No (or minimal) HTML/JavaScript generation on server side• All client interaction is done in JavaScript• All middleware/database stuff is done on the server side (platform agnostic)• Communication is done AJAX style, using Ext.Direct RPC protocol
  5. 5. Ext JS Advantages• Cross browser compatibility (even IE6)• Really good code and issue separation• Very low overhead on server side• Very low traffic (only data goes on wire)• Clean MVC architecture – easier to develop• But wait, where’s Perl?
  6. 6. Perl shines through• Perl can be used to develop server side• Does things it does best• Works anywhere• Really easy to plug in existing code• Uses RPC::ExtDirect as the glue
  7. 7. Introducing RPC::ExtDirect• Abstract module that implements Ext.Direct protocol• Has gateways for CGI, Plack (maybe mod_perl in future)• Compatible down to 5.6.0• Only one non-core dependency: JSON.pm (can be pure Perl)
  8. 8. Using RPC::ExtDirect1. Declare Action (Class, Namespace):package Foo::Bar;use RPC::ExtDirect Action => Fubar;sub foo : ExtDirect(2) { my ($class, $arg1, $arg2) = @_; # do something, store results in scalar my $result = ...; return $result;}
  9. 9. Using RPC::ExtDirect, cont.2. CGI example part 1, API publisher (api.cgi):use CGI::ExtDirect;use My::ExtDirect::Published::Module::Foo;use My::ExtDirect::Published::Module::Bar;my $direct = CGI::ExtDirect−>new();print $direct−>api(); # Prints full HTTP response
  10. 10. Using RPC::ExtDirect, cont.1. CGI example part 2: request routeruse CGI::ExtDirect;use RPC::ExtDirect::API api_path => /extdirect_api, router_path => /extdirect_router’;use My::ExtDirect::Published::Module::Foo;use My::ExtDirect::Published::Module::Bar;my $direct = CGI::ExtDirect−>new({ debug => 1 });print $direct−>route(); # Prints full HTTP response
  11. 11. Possible applications• New stuff from scratch, easy and fast• Retrofit old applications with shiny Web interface• Convert terminal apps to Web apps (screen scraping?)• Easily hack together Web admin apps using proven command line tools• Gluing together heterogeneous applications (Web interface for ancient COBOL app?)• More and more…
  12. 12. Conclusion• CMS Webdash live demo (if any)• Questions? Drop me an email:Alex Tokarev <tokarev@cpan.org>

×