[Dancer-users] Hooks for Dancer::Continuation::* ???

Perlover perlover at perlover.com
Fri Dec 16 15:07:10 CET 2011


Good day!

I used Dancer of 1.3080 & 1.3090 branches
In my routes i use setlocale for changing locales

I did a following for example:

hook 'before' => sub {
    $oldLocale = setlocale(LC_ALL);
    setlocale(LC_ALL, 'ru_RU.UTF-8');
}

hook 'after' => sub {
    setlocale(LC_ALL, $oldLocale);
};

And in my routes i use send_error();

send_error throws an continuation exception and my after hook doesn't
finish. The  on_handler_exception & on_route_exception will not help
because their for non continuation exceptions as i understand by view
sources.
After requests with send_error() i have an other locale for Starman +
Dancer process when request in finished. It's bad for me because 1) I
want to restore ALWAYS my previous locale AFTER ANY ROUTE; 2) And for
other locales i got other number formats in HTTP response headers for
example

I didn't find any hooks for continuation exceptions.
How can i execute my subroutine ALWAYS when any route has finished?
Even i use a send_error()...

Alexey


More information about the Dancer-users mailing list