foopoiuyt / Yote

perlish Application Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

See http://fenowyn.com/yote for more information.

Quickstart for OSX / Linux

It's as easy as...

1. Install Yote
$ perl Build.PL
$ ./Build
$ ./Build test
$ ./Build install
2. Start the server
$ yote_server --port=8001 # 8001 is the default. This can be run on 80 to serve pages.
3. Write your own code (e.g. "hello world" app, website code, etc)

Requirements

  • perl version 5.10

Verify / install the requirements

Following is how to verify that you have each of the requirements and, if not, to get it.

  • perl version 5.10

    To verify if you have this:

    $ perl -v

    If your version is too low, look at using perlbrew to upgrade:

    http://search.cpan.org/~gugod/App-perlbrew-0.39/bin/perlbrew

    (From the perlbrew docs:)

    $ curl -kL http://install.perlbrew.pl | bash
    $ ~/perl5/perlbrew/bin/perlbrew install 5.14.2  # Current version as of 2012-01-20
    $ ~/perl5/perlbrew/bin/perlbrew use 5.14.2
    $ perl -v  # Should now tell you 5.14.2

    This installs the perlbrew executable, the perl-5.14.2 executable, and all core Perl modules into ~/perl5/perlbrew/. It then sets the current shell to use the new version.

    You may also want to use cpanm (or another CPAN shell) to install additional modules for the new perl version.

  • run javascript tests

    Start yote :

    $ yote_server --port=8001 

    launch a web browser with the address :

    http://localhost:8001/yote/unit_tests.html

Using Yote

Start the Web App Server

Starting the Web App Server from the command line:

$ script/yote_server

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,
           datastore  => 'Yote::SQLiteIO',
           sqlitefile => 'yote.database' );

Coding with Yote

Client Side

<script src="./js/jquery-latest.js"></script>
<script src="./js/jquery.dumper.js"></script>
<script src="./js/jquery.base64.min.js"></script>
<script src="./js/json2.js"></script>
<script src="./js/yote.js"></script>
<script>
    var hello_app = $.gServ.fetch_app( 'Yote::Hello' );
    var result = hello_app.hello({ name:"fred" } );
    var counter = hello_app.get_counter();
</script>

Server Side

package Yote::Hello;

use strict;
use Yote::Obj;
use base 'Yote::AppRoot';

sub init {
    my $self = shift;
    my $counter = $self->get_counter( new Yote::Obj() );
}

sub hello {
    my( $self, $data, $acct ) = @_;
    my $name = $data->{name};
    my $counter = $self->get_counter();
    $counter->set_count( $counter->get_count() + 1 );
    return "hello there '$name'. I have said hello ". $counter->get_count() . " times.";
}

1;

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 74:

Expected '=item *'

About

perlish Application Server


Languages

Language:Perl 71.3%Language:JavaScript 28.7%