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

damien krotkine dkrotkine at gmail.com
Fri Dec 16 17:14:43 CET 2011


I have a fix, in Pull request 174 :

https://github.com/sukria/Dancer/pull/714

On 16 December 2011 16:55, damien krotkine <dkrotkine at gmail.com> wrote:
> Hi,
>
> I'm working on fixing the issue.
>
> On 16 December 2011 16:47, Perlover <perlover at perlover.com> wrote:
>> I am here again ;-)
>>
>> I found resolving
>>
>> In psgi file:
>>
>> use Dancer::Handler ();
>> use POSIX qw (LC_ALL setlocale);
>>
>> my $prevRenderRequest = \&Dancer::Handler::render_request;
>> my $locale;
>>
>> *Dancer::Handler::render_request = sub {
>>    $locale = setlocale(LC_ALL);
>>    $prevRenderRequest->(@_);
>>    setlocale(LC_ALL, $locale);
>> };
>>
>>
>> I think it's better way for Dancer 1
>>
>> Best regards!
>>
>> 2011/12/16 Perlover <perlover at perlover.com>:
>>> 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
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users


More information about the Dancer-users mailing list