Dancer

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 - Show version when starting standalone server. (David Precious)

1.3003 2011 .02.06
 [API CHANGES]
 - Remove load_plugin from the core's DSL (was deprecated).

 [BUG FIXES]
 - Eliminate test warnings on Windows. (Gabor Szabo)
 - GH#271 - use correct VERSION_FROM in scaffolded application. (Sawyer X)
 - GH#260 - send_file doesn't clobber existing headers (Alexis Sukrieh)
 - logger unicode bugfix in the formated date (jahmed)
 - GH#281 - Don't crash if splat is used with no captures (David Precious)
 - Possible to given "template" a view name with the extenstion. (Alexis
   Sukrieh)

 [ENHANCEMENTS]
 - New setting log_path to allow for alternalte logging path in logger
   "file". (Natal Ngétal)
 - GH#289: Add more aliases on the ENV, provide more smart accessors to
   Plack env entries (Franck Cuny)

1.3002 2011-02-02
 [API CHANGES]
 - to_json and from_json accept options as hashref instead of hash. Passing
   arguments as hash is deprecated  (Franck Cuny).

 [BUGFIXES]
 - status is kept even when halt is used in a before filter (Alexis
   Sukrieh) * Proper handling of temporary file creation using File::Temp
   module instead of homebrew solution. (jahmed) * Logger::Abstract unicode
   bug fix. (jahmed)

 [ENHANCEMENTS]
 - In development, pretty-print JSON serializations for easier development 
   (Ask Bjørn Hansen)

1.3001 2011-01-27
 [Alberto Simoes]
 - Support for aliases for content_type and refactoring of  mime-types
   handling, with a new class Dancer::MIME (closes issue GH #124)

Changes  view on Meta::CPAN

 [Naveen]
 - add a --no-check switch to script/dancer to disable remote check of new
   Dancer versions.

 [Philippe Bruhat]
 - add script/wallflower, helper to turn a Dancer application into a static
   web site.
 - better behaviour for plugin_setting (better search, more user-friendly)

 [jamhed]
 - Fix some unicode issues, refactored all file openings in one function in
   Dancer::FileUtils.

1.2003 2010-12-10
 - Production release.

1.2002_02 2010-12-08
 [Danijel Tasov]
 - Correct HTTP.pm POD's 503 entry with 403.

 [Paul Tomlin]

Changes  view on Meta::CPAN

 - Load Plack::Loader dynamically in test.

 [Yanick Champoux]
 - Doc fix.

1.1999_03 2010-11-11
 [Al Newkirk]
 - fixed redirect to redirect immediately (+ refactoring by franck)

 [Alexis Sukrieh]
 - Transparent unicode support Dancer now takes care transparently of
   decoding unicode strings used within route handlers and encoding them
   back before sending a response content. Once the 'charset' setting is
   set, the user has nothing more to do to have a working unicode-aware
   application.
 - FIX for issue #172 More documentation added to Dancer::Request, all
   public method are documented. A pod coverage test has been added for
   this module.
 - Documentation update The deployment documentation is more precise about
   cgi/fast-cgi deployment under Apache.
 - FIX for issue GH#171 Scaffolded configuration files are fully commented
   in order to quickly guide the user in her first steps.

 [Damien Krotkine]

MANIFEST  view on Meta::CPAN

t/00_base/15_dependent_modules.t
t/00_base/17_globalwarnings_config_on.t
t/00_base/config.t
t/00_base/easymocker.t
t/00_base/lib/AppWithError.pm
t/00_base/lib/WorkingApp.pm
t/00_base/normalize_path.t
t/00_base/optional-module-versions.t
t/00_base/uri_for.t
t/00_base/utf8.tt
t/00_base/views/unicode.tt
t/01_config/01_settings.t
t/01_config/02_mime_type.t
t/01_config/03_logger.t
t/01_config/04_config_file.t
t/01_config/05_serializers.t
t/01_config/06_config_api.t
t/01_config/06_stack_trace.t
t/01_config/07_strict_config.t
t/01_config/08_environments.t
t/01_config/environments/development.pl

MANIFEST  view on Meta::CPAN

t/02_request/18_param_accessor.t
t/02_request/19_json_body.t
t/02_request/20_body.t
t/02_request/21_dancer_response_multiple_params.t
t/03_route_handler/01_http_methods.t
t/03_route_handler/02_params.t
t/03_route_handler/03_routes_api.t
t/03_route_handler/04_routes_matching.t
t/03_route_handler/04_wildcards_megasplat.t
t/03_route_handler/05_filter.t
t/03_route_handler/05_unicode.t
t/03_route_handler/06_redirect.t
t/03_route_handler/07_compilation_warning.t
t/03_route_handler/08_errors.t
t/03_route_handler/12_response.t
t/03_route_handler/12_response_halt.t
t/03_route_handler/14_options.t
t/03_route_handler/15_prefix.t
t/03_route_handler/16_caching.t
t/03_route_handler/16_embedded_prefixes.t
t/03_route_handler/18_auto_page.t

MANIFEST  view on Meta::CPAN

t/11_logger/02_factory.t
t/11_logger/03_file.t
t/11_logger/04_console.t
t/11_logger/05_format.t
t/11_logger/06_null.t
t/11_logger/07_diag.t
t/11_logger/08_serialize.t
t/11_logger/09_capture.t
t/11_logger/10_note.t
t/11_logger/11_runtime_file.t
t/11_logger/unicode.t
t/12_response/000_create_fake_env.t
t/12_response/01_CRLF_injection.t
t/12_response/02_headers.t
t/12_response/03_charset.t
t/12_response/04_charset_server.t
t/12_response/05_api.t
t/12_response/06_filter_halt_status.t
t/12_response/07_cookies.t
t/12_response/08_drop_content.t
t/12_response/09_headers_to_array.t

SIGNATURE  view on Meta::CPAN

SHA256 73e14f2e7405433b0e1ea06a3313297c6bef07a8233dcf5d68c6960c8b13e063 t/00_base/15_dependent_modules.t
SHA256 bac784440a43555f1e9abffc873c9c11e02f3c5108144b138c4bfa588a9c173b t/00_base/17_globalwarnings_config_on.t
SHA256 6183768d6ab1d860ea442d6779d45845f6b4ebd8d66c0e40c51d0601631d737e t/00_base/config.t
SHA256 5ab0fc0597aab972c423654d84dfd9de771998e3d750ce3d719c98e60e7e1603 t/00_base/easymocker.t
SHA256 dbb2d5f6624c0c05399cf74ea6ce4429fe53bb1e490a02b0562c327b2a79995b t/00_base/lib/AppWithError.pm
SHA256 29e2028d89c441b03adecd516bf1dd66c2dd4a3759d82faaf28fdc6bde3361a4 t/00_base/lib/WorkingApp.pm
SHA256 6c09dde3ebbe2dac6509981f0ad7137b709087037d8527c9c49155c93b79ffbc t/00_base/normalize_path.t
SHA256 984d6d6b55d66129aec2fe226784ce1498099b64b3bf465b2409b16ec7ba57e0 t/00_base/optional-module-versions.t
SHA256 f7d6bace00a144b57b91ee96056d8d4c68f8fc7d0be4414f7f4451c27977f230 t/00_base/uri_for.t
SHA256 b44f2248df36874e7d9f39c97ab2d9616f97655ebfb5c7c7dfdbdb56a8929273 t/00_base/utf8.tt
SHA256 590d4a6b3d28d23c8a4fcfcf7608f4efe398654d70bde20674d5c1a0cdf47b6d t/00_base/views/unicode.tt
SHA256 c85493fdfd6dfc547c01fcaa8cb98661f03e8092ac9b48b6931c0bc269ae0e77 t/01_config/01_settings.t
SHA256 94c0b1d06bc507c1cc1ae7cc22cf71c0d3b868ef42f23f21969560d1b76cbcae t/01_config/02_mime_type.t
SHA256 7ecae217305de5dcba87ca22f5603ee588a33db259bbe2876466906e2ce2e728 t/01_config/03_logger.t
SHA256 fd4d25081e8624969c92346364f791034175a85d09ef5e9b82f36dac840cb577 t/01_config/04_config_file.t
SHA256 ac1dcee2c93d9028d0848f3a1b7b6a190c831e195e6da3242933f199fc3dc80d t/01_config/05_serializers.t
SHA256 5a58d3b6241549a7dabb0f46fee1937ca5c8bfc6e67f5e8ec0745a79a75de303 t/01_config/06_config_api.t
SHA256 e437f5376adc8213c6d5d9b5487ebfb26ed06ce530c35bdb4496b100cc369b1c t/01_config/06_stack_trace.t
SHA256 43e77a60252dfc42ce2d20f9cd10c92a1541f5b90570dbb9c3a0e70b06ec5703 t/01_config/07_strict_config.t
SHA256 5a96a6d48c09dd93c49240e7c125308cfb3cb2668e0408855d4fae313c04f7f2 t/01_config/08_environments.t
SHA256 97a18ae8e28c3a8e24dc4a46fbb47a8106f7ca3e9e7a2015212caa44bf64db43 t/01_config/environments/development.pl

SIGNATURE  view on Meta::CPAN

SHA256 f86b2bfd6b60ad50797ef1506d97554bffd704ba3888bcda715d72549953dcfc t/02_request/18_param_accessor.t
SHA256 b9fc22a3b680aeeca639a9fce4df5476fbca41e48ff4e717e8de85ddbabe6fc0 t/02_request/19_json_body.t
SHA256 a7c4f0be31462cd499f840ef66d18411cbd8c4569069155d2d9ff421bf7791a3 t/02_request/20_body.t
SHA256 aae5bda971355fc35336da7f7e57ec63f610b61d311e5eb7124047362cd7f168 t/02_request/21_dancer_response_multiple_params.t
SHA256 8a43a3f2fc6a257a4e651d0e8e1eaefaec9ba2f1246886d5e8e0f8acbd275980 t/03_route_handler/01_http_methods.t
SHA256 d1c8b2750f0f8f9b30b7ed3029e8a47c3d1b59c15dd280b49e8ff4583cc9e4db t/03_route_handler/02_params.t
SHA256 e52459a0cd8b0464710f6f402f1305bf6076da15f3a2124a5e5233235309cb13 t/03_route_handler/03_routes_api.t
SHA256 3e211bd463d8cdcf61f0ab4f463561ab3446e306582d88d1768fa2e5869082f8 t/03_route_handler/04_routes_matching.t
SHA256 8887c3c2dc181c805621a1c52545d34bf0f5dce64db94a7efa336ba1315c54d3 t/03_route_handler/04_wildcards_megasplat.t
SHA256 771e10e55818233ece1e101d99a8c6e59aa318e2302b13b74612e9d1dd67647b t/03_route_handler/05_filter.t
SHA256 f4ff9f5d5796d954c2bc146190296a9d96908074455bd4f8e3c38fbc8a54ae51 t/03_route_handler/05_unicode.t
SHA256 c6cac9f9e27764d75beed8889a4ec248dfcbe4e310fcc7df7cded2401beea227 t/03_route_handler/06_redirect.t
SHA256 8b9f1b232c3c912b3accafab8e0d37d7f4963ff9631b42ae10c934b70ee6c7de t/03_route_handler/07_compilation_warning.t
SHA256 87df45ad9c36ea460353e4de02baab4596f97748cd679fee00faf82400d08b30 t/03_route_handler/08_errors.t
SHA256 c099ca4876eca323e4e711c5f82f39d331b2e7458bb0b9724a10694f56c96ada t/03_route_handler/12_response.t
SHA256 fba5cbf9c29d192cb38824b89bc1cbb922fe21c3a27b4843535018798b9dc19c t/03_route_handler/12_response_halt.t
SHA256 e6b52b82678ef4ac3199eef0a18676e848adda9eb27641a3c992b8002c692e64 t/03_route_handler/14_options.t
SHA256 35bca2efe3439a2d7ec1b289768aec2c2f0f4bb8098c87373f03fca2ea5d9141 t/03_route_handler/15_prefix.t
SHA256 ba54c787429f45dbde4c21e05fc16200b451fd26b738ef18aa5af42c210aee17 t/03_route_handler/16_caching.t
SHA256 19decb1d62a675818a0f8ec4e745680bf99c2e0a1d2a43d68faec667f0c198aa t/03_route_handler/16_embedded_prefixes.t
SHA256 bea7f31d4c84e142b24a7062da90b4814d8804a0aeab72019dd15643f3a128c2 t/03_route_handler/18_auto_page.t

SIGNATURE  view on Meta::CPAN

SHA256 0c6dcc610df60b25dacada8eb8aa73ee8b03e23b75f57b1b447cd2a478ca686e t/11_logger/02_factory.t
SHA256 5d8f390d0fb07e4815d454d04d5ee3a4d855e0f52d587d4642f47f193ebad299 t/11_logger/03_file.t
SHA256 3b491f1466214a20c9cc5c13cee67ec72025ed4d797783838e1140c797c70499 t/11_logger/04_console.t
SHA256 7ed89ef85a772d94dcf81b2bd0c7877412be655d80919a663ed48b80b7357029 t/11_logger/05_format.t
SHA256 57f73b912c3ea67a4c8f522810f3e510c10702d92b3edb9017fce0daa9b74d8d t/11_logger/06_null.t
SHA256 ad1bd42627df1f43ea15e7c1899e9a67aac2a24de477f1f6246402accb738316 t/11_logger/07_diag.t
SHA256 c479b63c0026513955a237bac13dede05e10197629741d38920ef4a2d3d5e5c0 t/11_logger/08_serialize.t
SHA256 d3e1c9d2de30775fb8d5741dc4653fd58e945c1b4f570d6ca01425109a54347c t/11_logger/09_capture.t
SHA256 d92567be17c02a657dbe2a88952ae9c8979473a1ce360233ed76d8d7ac533128 t/11_logger/10_note.t
SHA256 31e95a165ee3948583fdd1c6a46e21e9e9f9364bb3a0d3693e4aedcc2a93f000 t/11_logger/11_runtime_file.t
SHA256 94dcbb41c701dc163f55c0564b782672cfb455f0fb54dbfd40093fbba0c4f6f5 t/11_logger/unicode.t
SHA256 c2173fc136fe9807df329fc2676eafef49a48709826ac5c9a49805fc2cfe758a t/12_response/000_create_fake_env.t
SHA256 7a4a6df38a064e11ff0b3a80489085a734c0a47b8dec1a8abd9220b9a23a4e86 t/12_response/01_CRLF_injection.t
SHA256 9d00242052c706c0a2a4460ca7850b278aa8ab74add507a7c4251571862cf3bb t/12_response/02_headers.t
SHA256 31795386fc100124d5c13335e6705e8931af1d906f62c0bb16f8bff4c9b1d833 t/12_response/03_charset.t
SHA256 00259827ba98fdbdaf1dff866816d1bdcd521ffab2c4a18ca169f79df41d931c t/12_response/04_charset_server.t
SHA256 d3bca35b57321a427457c286853f211fd6f1de119240f57e442169275b8eb9d3 t/12_response/05_api.t
SHA256 5d75f809a8c34dc7a3ec6b03e789f8a270676add3bc52726f501d23da9c11ee3 t/12_response/06_filter_halt_status.t
SHA256 7c2cf7ab1bdfe8fbd6a155796b6c91400d31c6b41f5f23705262ddfdfd1024d2 t/12_response/07_cookies.t
SHA256 adee8c79be0459972b756360f8f4cff0626eea992b4d4f0861958c1aaaf12482 t/12_response/08_drop_content.t
SHA256 319afc870124e88054419027898f8b2556b5d0f1456bf0dd00e3ceba567c95b1 t/12_response/09_headers_to_array.t

bin/dancer  view on Meta::CPAN


# Your application's name
appname: \"$name\"

# The default layout to use for your application (located in
# views/layouts/main.tt)
layout: \"main\"

# When the charset is set to UTF-8 Dancer will handle for you
# all the magic of encoding and decoding. You should not care
# about unicode within your app when this setting is set (recommended).
charset: \"UTF-8\"

# template engine
# simple: default and very basic template engine
# template_toolkit: TT

template: \"simple\"

# template: \"template_toolkit\"
# engines:

lib/Dancer/Cookbook.pod  view on Meta::CPAN

        $tokens->{uri_base} = request->base->path;
    };

Then in your layout, modify your css inclusion as follows:

    <link rel="stylesheet" href="<% uri_base %>/css/style.css" />

From now on, you can mount your application wherever you want, without
any further modification of the css inclusion

=head3 template and unicode

If you use L<Plack> and have some unicode problem with your Dancer application,
don't forget to check if you have set your template engine to use unicode, and
set the default charset to UTF-8. So, if you are using template toolkit, your
config.yml will look like this:

    charset: UTF-8
    engines:
      template_toolkit:
        ENCODING: utf8

=head3 TT's WRAPPER directive in Dancer (META variables, SETs)

t/00_base/12_utf8_charset.t  view on Meta::CPAN

        is d($res->{content}), "\x{1A9}", "utf8 static response";

        $res = _get_http_response(GET => '/other/string', $port);
        is d($res->{content}), "\x{1A9}", "utf8 response through forward";

        $res = _get_http_response(GET => "/param/".u("\x{1A9}"), $port);
        is d($res->{content}), "\x{1A9}", "utf8 route param";

        $res = _get_http_response(GET => "/view?string1=".u("\x{E9}"), $port);
        is d($res->{content}), "sigma: 'Æ©'\npure_token: 'Æ©'\nparam_token: '\x{E9}'\n",
            "params and tokens are valid unicode";
    },
    server => sub {
        my $port = shift;

        use Dancer;
        use t::lib::TestAppUnicode;

        set( charset      => 'utf8',
             host         => '127.0.0.1',
             port         => $port,

t/12_response/04_charset_server.t  view on Meta::CPAN

    client => sub {
        my $port = shift;
        my $ua = HTTP::Tiny::NoProxy->new;
        my $res = $ua->post_form("http://127.0.0.1:$port/name", [ name => 'vasya' ]);

        my $headers = HTTP::Headers->new(%{$res->{headers}});
        is $headers->content_type, 'text/html';
        ok $headers->content_type_charset; # we always have charset if the setting is set
        is $res->{content}, 'Your name: vasya';

        $res = $ua->get("http://127.0.0.1:$port/unicode");

        $headers = HTTP::Headers->new(%{$res->{headers}});
        is $headers->content_type, 'text/html';
        is $headers->content_type_charset, 'UTF-8';
        is $res->{content}, Encode::encode('utf-8', "cyrillic shcha \x{0429}");
    },
    server => sub {
        my $port = shift;

        use lib "t/lib";

t/12_response/04_charset_server.t  view on Meta::CPAN

             startup_info => 0 );
        Dancer->dance();
    },
);

Test::TCP::test_tcp(
    client => sub {
        my $port = shift;
        my $ua = HTTP::Tiny::NoProxy->new;

        my $res = $ua->get("http://127.0.0.1:$port/unicode-content-length");

        my $headers = HTTP::Headers->new(%{$res->{headers}});
        is $headers->content_type, 'text/html';
        # UTF-8 seems to be Dancer's default encoding
        my $v = "\x{100}0123456789";
        utf8::encode($v);
        is $res->{content}, $v;
    },
    server => sub {
        my $port = shift;

t/12_response/04_charset_server.t  view on Meta::CPAN


SKIP: {
    skip "JSON module required for test", 2 
        unless Dancer::ModuleLoader->load('JSON');

    Test::TCP::test_tcp(
        client => sub {
            my $port = shift;
            my $ua = HTTP::Tiny::NoProxy->new;

            my $res = $ua->get("http://127.0.0.1:$port/unicode-content-length-json");

            my $headers = HTTP::Headers->new(%{$res->{headers}});
            is $headers->content_type, 'application/json';
            is_deeply(from_json($res->{content}), { test => "\x{100}" });
        },
        server => sub {
            my $port = shift;

            use lib "t/lib";
            use TestAppUnicode;

t/lib/TestApp.pm  view on Meta::CPAN

};

any['put','post'] => '/jsondata' => sub {
    request->body;
};

post '/form' => sub {
    params->{foo};
};

get '/unicode' => sub {
    "cyrillic shcha \x{0429}",
};

get '/forward_to_unavailable_route' => sub {
    forward "/some_route_that_does_not_exist"
};

get '/issues/499/true' => sub {
    "OK" if system('true') == 0  
};

t/lib/TestAppUnicode.pm  view on Meta::CPAN


get '/other/string' => sub {
    forward '/string';
};

get '/param/:param' => sub {
    params('route')->{'param'};
};

get '/view' => sub {
    template 'unicode', { 
        pure_token => 'Æ©', 
        param_token => params->{'string1'}, 
    };
};

get '/form' => sub {
    debug "params: ".to_json({params()});
    debug "utf8 : é-\x{1AC}";

    template('unicode', { 
        char => "é-\x{E9}",
        string1 => params->{'string1'},
        token => to_json { 'params' => { request->params} }
    })."\x{E9} - string1: ".params->{'string1'}
};

get '/unicode-content-length' => sub {
    "\x{100}0123456789";
};

get '/unicode-content-length-json' => sub {
    { test => "\x{100}" };
};


1;



( run in 0.619 second using v1.01-cache-2.11-cpan-f29a10751f0 )