                                TODO

            
            This is the roadmap of upcoming developments


* Support for HEAD requests

    Any GET method defined should also honour a HEAD method by just sending the
    response header, without the body.

    Currently, Dancer rejects HEAD requests with the default 404 error.

* Route caching support

    When a path is firstly resolved through the route tree, we should
    cache the result for future calls.

    The path would be the cache key, the first route the value.

        1 - GET / -> first call, so browse the route tree
        2 - GET / -> second call, return cache('/');

* Conditions support for route matching: 

    get '/foo', {agent => 'Songbird (\d\.\d)[\d\/]*?'} => sub {
        ...
    };

* Use YAML for configuration files

    Using pseudo Perl script for configuration is bad. YAML is the perfect
    choice for an effortless framework.

* Helper script

    We need an helper script for providing a bootstraping method for 
    creating new applications.

    The helper script should be named dancer, and would be usable
    like the following:

    $ dancer --help
    dancer - helper script for bootstraping Dancer web applications

    Usage: dancer [options] <appname>
    Create the directory `appname' according to the given options.

    Options:

    --template     create a views directory and make sure
                   Template is installed.
    
    Here is the output of the command:

    $ dancer --template /srv/webapps/myblog
    + creating /srv/webapps/myblog
    + creating /srv/webapps/myblog/public
    + creating /srv/webapps/myblog/public/errors
    + creating /srv/webapps/myblog/public/errors/500.html
    + creating /srv/webapps/myblog/public/errors/404.html
    + creating /srv/webapps/myblog/public/errors/503.html
    + creating /srv/webapps/myblog/public/css
    + creating /srv/webapps/myblog/public/css/style.css
    + creating /srv/webapps/myblog/views
    + creating /srv/webapps/myblog/views/layouts
    + creating /srv/webapps/myblog/views/layouts/main.tt
    + creating /srv/webapps/myblog/myblog-server.pl
    + creating /srv/webapps/myblog/environment.pl
    + creating /srv/webapps/myblog/environments/
    + creating /srv/webapps/myblog/environments/production.pl
    + creating /srv/webapps/myblog/environments/development.pl


* Error handler support

    It should be possible to handle errors in two different ways.
    - detailed: when an error occurs, Dancer renders a page with as
      many details as it can concerning the error
    - hidden: when an error occurs, a generic page is sent to the
      user describing the kind of error. This is done with a
      send_file statement, using views/error/ERRCODE.html

    These error rendering modes should be set through the
    'errors' setting :

    set errors => detailed;

    or

    set errors => hidden;


* Environment support

    It should be possible to run a Dancer server with a specific
    environment, like development or production.

    This could be done like the following:

    $ ./my-dancer-app.pl --environment production

    Then the script appdir/environments/development.pl would be
    loaded.

    Content for environments/development.pl

        set access_log => true;
        set verbosity => true;
        set errors => detailed;
        set port => 3000;

        end;
    
    Content for environments/production.pl

        set access_log => true;
        set verbosity => false;
        set errors => hidden;
        set port => 3000;

        end;

    The environments files are pure Perl files, they are loaded with
    the require mechanism, so the can be written with the Dancer
    syntax.

    The `end' keyword just returns true, it's sugar for configuration
    files. 


* Session support

    We need a way to support web session in the easiest way possible.

    Maybe something like that:

    set session => true; # enable the session engine

    get '/login' => sub {
       template 'login' 
    };

    post '/login' => sub {
        my $user = User->authenticate(params->{login}, params->{password});

        if ($user) {
            session user_id => $user->id;
        }
        else {
            var error => "Bad credentials";
            pass;
        }
    };

    Then the key 'user_id' should be accessible in other requests:

    before => sub {
        if (not session->{user_id}) {
            var error => "Must be authenticated";
            request->path_info('/error');
        }
        else {
            var user => User->find(session->{user_id});
        }
    };

    get '/home' => sub {
        "Hello ".vars->{user}->name
    };

