[Dancer-users] messed up routes

Mr. Puneet Kishor punk.kish at gmail.com
Thu Oct 20 18:22:59 CEST 2011


On Oct 20, 2011, at 11:15 AM, Brian E. Lozier wrote:

> On Thu, Oct 20, 2011 at 9:13 AM, Mr. Puneet Kishor <punk.kish at gmail.com>wrote:
> 
>> 
>> On Oct 20, 2011, at 10:47 AM, Naveed Massjouni wrote:
>> 
>>> On Thu, Oct 20, 2011 at 9:36 AM, Mr. Puneet Kishor <punk.kish at gmail.com>
>> wrote:
>>>> 
>>>> On Oct 19, 2011, at 11:46 PM, Matthew Vickers wrote:
>>>> 
>>>>> On 20/10/11 2:51 PM, Mr. Puneet Kishor wrote:
>>>>>> Suggestions? I am serving about 10 or 12 different apps using Starman
>> proxied behind Apache2, if that is any help.
>>>>>> 
>>>>> Hi Puneet,
>>>>> 
>>>>> Have you tried setting the layout in the template call ?
>>>>> 
>>>>> ...
>>>>> 
>>>>> template 'video_mov', \%template_opts, { layout =>  'main_video' };
>>>>> 
>>>>> ...
>>>>> 
>>>>> template 'presentation_slides', \%template_opts, { layout =>  layout
>> 'main_presentation' };
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> hmmmm... so you are implying that perhaps having a separate `layout
>> 'main_presentation'` is not enough? Or, are you implying that even though I
>> have `layout 'main_presentation'` in the presentation route, and `layout
>> 'main_video'` in the video route, perhaps I am seeing these problems because
>> I don't have `layout 'main'` in my regular route?
>>>> 
>>> 
>>> I think he was saying that you might have code in your apps such as:
>>>   set layout => 'foo';
>>> This would set the layout globally and might have been the cause of your
>> issue.
>> 
>> In that case, no, I never used `set layout => 'foo'` anywhere in my code.
>> Only within specific routes, I used `layout 'foo'`. So, one, IFF `layout
>> 'foo'` has the same effect as `set layout => 'foo'`, even then it shouldn't
>> have mattered, because every route is doing its own `layout 'foo'`. In other
>> words, even if me or some other user requests a route that does `layout
>> 'foo'`, when me or the other user requests a route with a different layout,
>> that route has its own `layout 'bar'`. I don't see how even cross browser or
>> cross computer invocations could affect.
>> 
>> 
> If it's a global variable, isn't it possible that you can set it in one
> route and then a concurrent request to another resource can overwrite it
> between the time you set it and the time you use it?
> 
> 


sure, but that is only if my own request came from a route that didn't implement a layout. What I am saying is -- 

- I don't have any layout being set outside of a route; and
- all my routes are setting a layout

So, at the instant that my query hits the server, the application figures out the route for me. In the process of doing so, the application learns of the template to use for that route, because when it goes through the code for that route, and does all the other stuff such as getting the data for that route and assembling it into a web page, it also learns of the specific layout to use.

Hmmm... are you saying that *after* my request has figured out the route to use but *before* is has assembled it using the layout for that route, someone else queried a different route in my application and, thus, reset the layout to a different layout? Vaguely possible, but heck, this is my personal web site... not amazon.com. About 3 people a year visit it. If I keep refreshing my browser by hitting Cmd-R, I keep on getting the wrong layout.

Maybe this is because of some global setting, but somehow methinks there is something funky in the routes-choosing mechanism... or, maybe it is something that I have no idea about.

--
Puneet Kishor



More information about the Dancer-users mailing list