[cgiapp] [patch] CAP::MessageStack + CAP::FormState

Jason Purdy jason at journalistic.com
Mon Oct 12 09:57:26 EDT 2009


Rumors of CAP::MessageStack death are greatly exaggerated. ;)

I apologize for the lack of a response and I wanted to apologize 
publicly. I actually owe David Steinbrunner an even bigger apology for 
sitting on his work for close to 2 years. I admit I'm a bad CPAN author 
and fall victim to the "if it ain't broke, don't fix it" mindframe. I 
know when I submit bugs & patches, I expect action soon-after. So I 
admit it's hypocritical of me and again, I'm sorry.

I took a look at your problem & patch and in my opinion, there's room 
for discussion on its merits. That's another reason I'm replying 
publicly: to get others' thoughts.

First, the problem. It's something that's disclaimed in the 
documentation and examples. It's not really a bug as I see it, versus 
its intended result. If you're bringing in a plugin, you should 
accommodate its behavior, which with MessageStack, you can do easily by 
overriding the die_on_bad_params or putting the variables in your 
templates. I fall victim to the "bug" myself from time-to-time, but I 
use CGI::Carp's fatalsToBrowser and it let's me know what's wrong and I 
fix it.

Second, your patch isn't efficient and it's not complete. You're loading 
the template to inspect its structure, which will add a second template 
loading process and without the "TODO" code to check if 
die_on_bad_params is 0, this will happen everytime. Granted, that TODO 
code is pretty easy to work out, but that needs to be done and I'm 
interested in a more efficient solution.

CAP::TT has a neat method that I don't fully understand yet with 
new_hook and call_hook. Perhaps that might be the way to go. Ideally, we 
could change _pass_in_messages from being called before the template is 
loaded to afterwards, when we can inspect the template structure.

- Jason

Alex wrote:
> Hi all!
> 
> Are CGI::Application::Plugin::MessageStack and FormState dead? Will the lack
> of maintenance force users to abandon it and use other modules? Will this
> force ppl to code the same functionality over and over again - in
> contradiction of the idea of a flexible framework?

[snip]


More information about the cgiapp mailing list