[Dancer-users] Bug in Dancer1 (devel branch) - no request->header inside routes

Perlover perlover at perlover.com
Wed Nov 23 17:48:38 CET 2011


Sorry
I have strange behavior but i think but i think this code is not root of problem

My request->header from route code throws the exception as Can't call
method "header" on an undefined value at
/usr/local/share/perl5/Dancer/Request.pm line 92. in
/usr/local/share/perl5/Dancer/Handler.pm l. 101
But i cannot make a correct patch for it yet
The github's branch is 'devel'

I am finding a problem...

2011/11/23 Perlover <perlover at perlover.com>:
> Hello,
>
> I found a bug as i think in Dancer1 -> devel branch
>
> Please take a look at Dancer::Deployment -> Running multiple apps with
> Plack::Builder
>
>           my $app2 = sub {
>               my $env = shift;
>               local $ENV{DANCER_APPDIR} = '/Users/franck/tmp/app2';
>               # 'mount_at' is used to guarantee that the routes of
> the applications do
>               # not intersect
>               load_app "app2", mount_at => "/app2";
>               Dancer::App->set_running_app('app2');
>               setting appdir => '/Users/franck/tmp/app2';
>               Dancer::Config->load;
>               my $request = Dancer::Request->new( env => $env );
>               ^^^^^^^^^^^^^^ Here $request->{headers} will be undef
> because Dancer::SharedData->headers will return undef (my variable
> $_headers will be undef)
>               Dancer->dance($request);
>               ^^^^^^^ Inside here in Dancer::Handler in the sub
> handle_request will be initialized $_headers of Dancer::SharedData but
> $request object will be keep {headers} as undef
>           };
>
> Thus in PSGI variant we will not get any headers through request->header('...')
>
> I can try to make patch for this
>
> Perlover
>


More information about the Dancer-users mailing list