Name YOTE Summary Yote is a platform for creating web based applications by bridging client side javascript with server side, automatically persistent perl objects. Yote provides javascript objects with methods that map to their server side counterparts. Yote also is a simple web server as well as an app server. Note As of this writing Yote is on version 0.086. It is not yet stable and is in pre-alpha mode. Consider this alpha software once version 0.100 is reached. Please email coyocanid@gmail.com to report bugs or issues or feature requests. Requirements * perl version 5.10 Install Yote $ export INSTALL_BASE=/usr/local/yote #optional. default is /usr/local/yote $ export YOTEPORT=8008 #optional #optional. default is 8008 $ # Thru CPAN --- $ cpan Yote $ # OR --- $ perl Build.PL $ ./Build $ ./Build test $ ./Build install Verify by running html test $ yote_server open http:///yote/unit_tests.html Using Yote Start the Web App Server Starting the Web App Server from the command line: $ yote_server --port=8008 # default is port set up with, or 8008 This starts the server on the default port (8008), using SQLiteIO, and writing to file ~/.yote/SQLite.yote.db. Starting the Web App Server from a package: use Yote::WebAppServer; my $server = new Yote::WebAppServer(); $server->start_server( port => 8008, webroot => 'path/to/my/html/files', sqlitefile => 'yote.database_filename' ); Coding with Yote Client Side Server Side package Yote::Hello; use strict; use Yote::Obj; # # Any subclass of Yote::AppRoot will have a singleton instance in the Yote engine # that will be returned to the client with '$.yote.fetch_app( "app classname" )'. # use base 'Yote::AppRoot'; # # Init is called only the very first time an Yote::AppRoot is instantiated. # This is not called when this object is retreived from storage. # sub init { my $self = shift; # # 'get_counter' does not need an explicit definition. # A get_ method passed an argument will initialize the field if it is undefined. # my $counter = $self->get_counter( new Yote::Obj() ); } #init # # Any server side method takes 3 optional arguments on the client side : # data, onSucceedFunction, onFailFunction # # Conversely, any server side method takes 3 automatically passed parameters : # self, data, account. # # The argument { name => "wilma" } is passed to the $data parameter of the method. # # If a user is logged in to Yote on the client, that user's account will automatcially # be passed into the server side method as the last argument. The account object is # a Yote::Obj object meant to store any information specific to the user *and* this # applications. A user will get a different account object for each different App. # sub hello { my( $self, $data, $acct ) = @_; my $name = $data->{name}; my $counter = $self->get_counter(); # # 'set_count' does not need an explicit definition. # $counter->set_count( $counter->get_count() + 1 ); # # The return value is a string in this case. # var msg = hello_app.hello({name:"foo"}); # msg will be the string "hello there 'foo'." # return "hello there '$name'. I have said hello ". $counter->get_count() . " times."; } #hello 1;