Key Features

Abstraction application code from the environment

There are many environments in which the web applications work:

    ---------------------------------------------
    |           mod_perl             Apache     |
    | FastCGI                       CGI         |
    |           ------------------------        |
    |     nginx |                      |        |
    |           |     Your code        | isapi  |
    |           |                      |        |
    |            ----------------------         |
    |  Shell            Test::More      IIS     |
    |        lighttpd                           |
    ---------------------------------------------

WebDAO designed to save developers from the details of the application environment, reduce costs with a change of environment, and to simplify debugging and testing applications. An important goal is to simplify and increase the speed of web development.

Dynamic structure of the domain logic

The structure of the domain logic is based on XML(HTML) file. The file name can be derived. For example, let his name be commonplace for web developers: index.xhtml.

  <body>
  <div>
   <wd>
     <object class="MyTest" id="page"/>
   </wd>
  </div>
  </body>

In this text, except for XHTML tags are used more, for example: wd and object. Tag wd is a sign of the special (interpreted) field. While there is no support for the XML namespace, but over time, I promise, it will appear.

Tags wd frame area in which there are definitions of objects and other interpretable tags. In the above example, using the command creates a instance of the class MyTest and identifier: page. This object identifier is used in the URL. For example:

    http://example.org/page
    http://example.org/page/Method?par1=1&par2=2
    
In the package I<WebDAO> include lexical analyzer, which processes the file and builds a structure of objects.

Create a file MyTest.pm with the following content:

    package MyTest;
    use WebDAO;
    use base 'WebDAO::Component';
    
    sub fetch {
        "Hello Web X.0!";
    }
    1;

Each of the domain structures involved in the formation of the results, shows himself. Therefore, in this example, the resulting XHTML will look like this:

    <body>
    <div>
       Hello Web X.0!
    </div>
    </body>

Addressing objects by URL

One of the main ideas WebDAO - resolve the URL to the domain structure of objects. For example, for URL:

    http:://example.com/test/Method?param=1&param2

Will be called the method Method at object test. The names of public methods that are available for applications from outside begin with a capital letter. The names of objects can be arbitrary.If the method is not specified - using the name index_x. If this method is not available at the object, returned to the status of "404: Not found". Thus the address below:

    http:://example.com/test/?param=1&param2
    http:://example.com/test/

Equivalent to the following:

    http:://example.com/test/index_x?param=1&param2
    http:://example.com/test/index_x

Built-in support session parameters

	
In I<WebDAO> built-in support sessional settings. Schematically, it can provide the following diagrams:

      +-----------------+      load    +------------------+   Storages:
      |                 | <----------  |                  | -> MLDBM files
      | Session object  |     store    | WebDAO::Store::* | -> Storable files 
      |                 | ---------->  |                  | -> MemCached,MemCacheDB
      +-----------------+              +------------------+ -> Custom storage ...
          ^          |
         /|\         |
          |          |
          |         \|/
          |          V
      +-----------------+
      |                 |
      |  WebDAO::Engine |
      |                 |
      +-----------------+
	
To do this, simply select the source storage in the configuration web server, and specify the attributes in the inherited class.

Example configuration (Apache web server):

    <VirtualHost *>
        ...
        #set Storable storage
        SetEnv wdStore WebDAO::Store::Storable
        #path for store
        SetEnv wdStorePar path=/tmp/sessions
        #Track session via cookies
        SetEnv wdSession WebDAO::Sessionco
        ...
    </VirtualHost>

The text of the module also need to create attributes:

    package MySess;
    use WebDAO::Component;
    use base 'WebDAO::Component';
    
    # define list of session attributes
     
    __PACKAGE__->mk_sess_attr( attr1 => undef, _attr2 => undef );
   
    sub UseAttr {
        my $self = shift;
        # read
        my $val = $self->attr1;
        ...
        $self->attr1('test_value');
    }