[cgiapp] New Plugin: RunmodeDeclare

Richard Jones ra.jones at dpw.clara.co.uk
Thu Oct 23 17:34:21 EDT 2008


Rhesa Rozendaal wrote:
> Richard Jones wrote:
>
>> Second, the superclass startmode seems to override the subclass 
>> startmode. With a setup where My::WebApp::Foo subclass inherits from 
>> My::WebApp superclass, a request to /myapp.cgi that maps to 
>> My::WebApp::Foo should display the subclass startmode template, but 
>> it doesn't - it loads the template defined in the superclass 
>> startmode instead. Specifying the rm eg /myapp.cgi?rm=rm1 does work 
>> as expected though - loads My::WebApp::Foo::rm1 template.
>>
>> I know I could specify the required rm in all requests 
>> (myapp.cgi?rm=start), but I'm using Dispatch where :app and :app/:rm 
>> are used in the dispatch table, and this works as documented with 
>> CAP::AutoRunmode - ie the subclass StartRunmode 'wins'.
>
> Yeah, a runmode named "start" is treated differently by cgiapp, and 
> I've already filed a bug report for it: 
> http://rt.cpan.org/Ticket/Display.html?id=39631
> Right now, every other name than "start" as startmode will work just 
> fine.
>
Well, actually my superclass startmode was called 'form_display' and my 
subclass startmode was 'default'. My example showing myapp.cgi?rm=start 
was misleading, and only used as an illustration - I could just as 
easily have used myapp.cgi?rm=runmode1. Sorry for the confusion. So 
where startmode default should be called, it actually loads startmode 
form_display instead. 

Dumping warn statements in the rm's shows the subclass startmode is not 
even visited, even though the console debug output shows: [Dispatch] 
creating instance of My::Mode1 - where the default startmode is. Hope 
this is clearer.
-- 

Richard Jones



More information about the cgiapp mailing list