PDA

View Full Version : Ext.Direct Perl



scottpenrose
23 Aug 2009, 2:58 PM
Hi Team

On Friday I built my first two Server Stack backends for Ext.Direct in Perl.

The first implementation (called simple) is there as a reference implementation. It is a useful source to help get you started porting Ext.Direct functionality to your own framework.

The second implementation (called modperl) is a more complete and functional implementation, and because all classes are loaded at Apache start time, it is quite fast.

I have not completed all functionality (e.g. file uploads).


http://scott.dd.com.au/wiki/Ext.Direct - to see a description
http://github.com/scottp/extjs-direct-perl/tree/master - for GitHub source
http://github.com/scottp/extjs-direct-perl/zipball/master - for a Zip version
http://scott.dd.com.au/demo/extjs-direct-perl/test/simple.html - Live demo (including field validation)
http://github.com/scottp/extjs-direct-perl/blob/master/README.TODO - TODO list


Enjoy

Scott
UPDATES

27/August/2009 - support for before/after hooks & form post data

SamuraiJack1
24 Aug 2009, 12:17 AM
Cool. How about to CPAN it?

scottpenrose
24 Aug 2009, 2:34 AM
CPAN is the plan... I like to put it up only once it is working though, so give me a day or two :-)

Scott

SamuraiJack1
24 Aug 2009, 2:38 AM
Sounds good, will be glad to help if needed.

scottpenrose
24 Aug 2009, 3:14 AM
Sounds good, will be glad to help if needed.

Thanks SamuraiJack. What I really need help with is firstly what features people would like? Within reason that is :-)

Here are some questions:


Configuration - what format should the CPAN module accept?
Class instantiation - do we need to bother? I have been calling the methods directly.
What target - CGI, CGI via simple Module, Apache modperl?


Mostly I am concentrating on the ModPerl implementation, as that is the one I am currently using, but I can easily abstract it.

Thanks.

SamuraiJack1
24 Aug 2009, 3:24 AM
Configuration - what format should the CPAN module accept?

To start a CPAN module use 'module-starter' command-line utility, provided in the Module::Starter distribution.



Class instantiation - do we need to bother? I have been calling the methods directly.

I'd recommend to use Moose (http://search.cpan.org/%7Edrolsky/Moose/lib/Moose.pm) - a modern class system implementation for perl. It will handle all the underlaying technical details, like providing constructors, etc.



What target - CGI, CGI via simple Module, Apache modperl?Mostly I am concentrating on the ModPerl implementation, as that is the one I am currently using, but I can easily abstract it.


I'd recommend to create an abstract standalone implementation first, and then a plugin for Catalyst (http://search.cpan.org/%7Eflora/Catalyst-Runtime-5.80011/).

scottpenrose
24 Aug 2009, 3:51 AM
To start a CPAN module use 'module-starter' command-line utility, provided in the Module::Starter distribution.


:-) Not quite what I meant. I have been writing Perl for about 17 years, have lots of perl modules on CPAN - http://search.cpan.org/~scott/

What I mean is - configuration format. E.g. Config::Config, or Perl Data dump or JSON parsed. Because it is Apache we could use Apache format, but that tends to be a bit heavy weight.


I'd recommend to use Moose (http://search.cpan.org/%7Edrolsky/Moose/lib/Moose.pm) - a modern class system implementation for perl. It will handle all the underlaying technical details, like providing constructors, etc.

Thanks. I quite like Moose, I used to produce heaps of code using Class::Std.


I'd recommend to create an abstract standalone implementation first, and then a plugin for Catalyst (http://search.cpan.org/%7Eflora/Catalyst-Runtime-5.80011/).
Yes I think Catalyst is an important one to write for. I have done a few projects with Catalyst but I can't say I am an expert.

I think the best approach right now is to complete the missing bits in simple - such as file upload.

Thanks

Scott

SamuraiJack1
24 Aug 2009, 4:14 AM
:-) Not quite what I meant. I have been writing Perl for about 17 years, have lots of perl modules on CPAN - http://search.cpan.org/~scott/ (http://search.cpan.org/%7Escott/)

Sorry )



What I mean is - configuration format. E.g. Config::Config, or Perl Data dump or JSON parsed. Because it is Apache we could use Apache format, but that tends to be a bit heavy weight.

Perhaps, Config::Any?

scottpenrose
25 Aug 2009, 2:02 PM
Perhaps, Config::Any?

Thanks, that is perfect. The really nice thing is that one supported input is JSON, which we need anyway.

scottpenrose
26 Aug 2009, 10:44 PM
New version released:


simple CGI now supports Form posts
modperl now supports loading config via Config::Any (Perl, JSON, YAML - you pick).
modperl now support CGI form posts and returns (example also updated to show error on email)
modperl now supports 'before' and 'after' method calls on each action and method - allows you to implement your own security, logging etc.
modperl now "use CGI;" for form data


Scott

scottpenrose
12 Nov 2009, 4:12 AM
Hi Team

Some new updates for the Perl Ext Direct implementation:



Support for format=json (to support Ext Designer)
Mod_perl version now supports reading config from the (or any) module. This not only allows a module to provide their own config, but provides a pretty easy way for a module to to introspection (depending on which object model used).
Before/After hooks now have a default (all classes), per class and a per method version, which allows full access control checks and support for object setup and tear down or a database commit.

Up on Git soon. Next release will be up on CPAN too.

Scott

grgur
21 Nov 2010, 11:52 PM
Sorry to bump this thread, but has there been any further development on your Ext Direct implementation?

scottpenrose
22 Nov 2010, 12:14 AM
Howdy. Yes the version(s) I have written I use in production now:

https://github.com/scottp/extjs-direct-perl

There are a few versions there, but I have not put them on CPAN (still some things to do for CPAN release)

* simple - the shortest pure perl version I could write as a demonstration
* modperl - what I use in production as it is faster
* acl & module - some better versions to release on CPAN

Further details on implementation here - http://scott.dd.com.au/wiki/Ext.Direct

Scott

grgur
1 Dec 2010, 3:58 AM
Beautiful! Looks and feels really great!

Have you given a thought about Catalyst integration?

abraxxa
13 Dec 2010, 3:44 PM
Moritz Onken's CatalystX::ExtJS (http://search.cpan.org/dist/CatalystX-ExtJS/) and Luke Saunders, Nicholas Perez and my Catalyst::Controller::DBIC::API (http://search.cpan.org/dist/Catalyst-Controller-DBIC-API/) are great ExtJS backend modules too!

xherbie
16 Aug 2011, 10:11 PM
Is this library working with the current ext-4.0.2a version.

best regards
Herbie