[cgiapp] Re: New Plugin: RunmodeDeclare

Rhesa Rozendaal perl at rhesa.com
Sun Sep 28 20:53:53 EDT 2008


Mark Stosberg wrote:
> On Mon, 29 Sep 2008 00:18:02 +0100
> Richard Jones <ra.jones at dpw.clara.co.uk> wrote:
> 
>> Mark Stosberg wrote:
>>> As Rhesa proposed, he has followed through and released a plugin to add the
>>> Devel::Declare / Method::Signatures magic to CGI::Application:
>>>
>>> http://search.cpan.org/perldoc?CGI::Application::Plugin::RunmodeDeclare
>> Looks like an interesting alternative to CAP::AutoRunmode. One minor 
>> irritant is having to put 'runmode foo ($c:)' everywhere (only if using 
>> $c instead of $self of course). Might be useful to be able to declare 
>> use CGI::Application::Plugin::RunmodeDeclare(invocant => '$c'), or just 
>> use CAP::RunmodeDeclare qw($c).
> 
> I agree with this sentiment.
> 
> This brings back to life the discussion we were having on IRC the other
> day about "$self" vs "$c".  


While I agree with the others about preferring $self, it doesn't hurt to have 
the option. The next release will allow you to say:

   use CGI::Application::Plugin::RunmodeDeclare invocant => '$c';


As for the order in which arguments are fetched, I don't mind swapping 
$self->param and $q->param in the fallback order. I don't have a practical use 
case either way. I only use $self->param in this context when CA::Dispatch 
puts url components there. I thought you might sometimes want to override a 
url component with a form field, but I haven't seen that happen yet.


Method::Signatures now respects code attributes. I'm going to try and see if I 
can make it easier to reuse mschwern's code, so I don't have to copy/paste his 
stuff every time he changes something. I'd very much like to be able to use 
the same signature features.


rhesa


More information about the cgiapp mailing list