Re: [cgiapp] Anyone tried param validation with Brannigan.pm?
Late to this thread - sorry. :) After giving Brannigan a cursory glance, it looks pretty nice, but what does this offer that Data::FormValidator doesn't? Plus DFV has a nice plugin that marries DFV to cgiapp pretty nicely, imo. - Jason On 07/25/2010 01:00 AM, Ron Savage wrote: Hi Folks Followup... On Fri, 2010-07-23 at 11:11 +1000, Ron Savage wrote: Hi Folks Among the bewildering array of param validation routines, I'm wondering what people think of the relative newcomer Brannigan, or any other such module for that matter. I like the fact that Brannigan is very light-weight, whereas my favourite Data::Verifier uses heaps of Moose::* modules. I've converted a project [1] from Params::Validate to Brannigan, and it's all going smoothly. I found 1 bug in Brannigan, but the author fixed it promptly. [1] A light-weight CMS I hope to release in a few weeks. # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] Anyone tried param validation with Brannigan.pm?
On 07/26/2010 08:51 AM, Jason Purdy wrote: After giving Brannigan a cursory glance, it looks pretty nice, but what does this offer that Data::FormValidator doesn't? From the opposite point of view, here are some things that Brannigan doesn't do that DFV does do and that I can't live without: 1) Validations can't be stacked. In my applications I like to give error messages depending on what's wrong, not just a simple blanket didn't pass kind of thing. So if I have an email field that must be less than 255 characters, all ascii chars, must be a valid email address, with a valid MX message and must not already exist in the database, then I want a separate error message for all of those. I can do this with DFV with custom constraint routines. This is an example that's almost exactly like what I have in an existing application: my $profile = { required = ['email', 'name'], constraint_methods = { email = [ string(max = 255, ascii_only = 1), email(check_mx = 1), unique(table = 'person', column = 'email'), ] }, }; Then with the resulting Data::FormValidator::Results object I can check not only which fields, but which constraints. And those custom constraint methods can set flags (like the name of the constraint failure) which help me determine if, for instance the email() constraint failed because it wasn't an email address or if that MX record was bad. 2) Built-in validation methods get special treatment. In DFV the only difference between built-in methods and custom methods are the package you import them from. All of them are higher-order subs which return subs that interact with the Data::FormValidator::Results object. It seems to me from looking at the Brannigan docs that built-ins get extra keys to make them easier to use but custom validation methods use the validate keyword. This means that it you can't distinguish between multiple types of failures in custom validation routines (see #1 above) 3) No filters. With DFV you can have filters like trim(), alphanum(), etc. These can be applied to all of your input fields or just certain ones. Brannigan looks like it can do single fields with the parse attribute, but I don't see any way to do that for every input. 4) Taint-handling. Almost all the time if I've validated some input it should also be considered non-tainted. And if it shouldn't I can turn that off selectively. But it's almost always what people want. 5) Better group handling: In DFV we have require_some, dependencies and dependency_groups. Not used in every form but really nice to have when you need them. -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] Form validation
Hi William I'm copying this to the CGI::App list. Hope you don't mind... On Mon, 2010-07-26 at 15:07 -0400, William Bulley wrote: I am seeing some traffic on the CGIAPP mailing list about data/form validation. You have spoken highly about Data::Verifier yet you are now switching (?) to Brannigan.pm and others are praising the older Data::FormValidator - so which is the best one to use (asked by me, who is clueless, as you are aware...)? :-) Here's a quick-n-dirty summary: Data::FormValidator: - Quite good - Very complex and long-winded to set up, in that sophisticated processing requires closures, and makes debugging also more complex - I used it for a long time - Superseded IMHO Data::Verifier: - Extremely good - Uses Moose, hence heavy-weight - Usage of Moose doesn't offer any real advantages over Brannigan unless you are testing if object belong to a class. It does have built-in support for Moose's types, if that matters. It doesn't to me. - I also used this successfully Brannigan: - Extremely good - Very light-weight - I pass data thru CGI::Untaint first which, really, we all should be doing. *: - There are many, many other validation modules, most of which are more-or-less tied to CGI form validation What may sway you is if a module ties in with HTML::FillInForm. That doesn't sway me. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622 # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] Anyone tried param validation with Brannigan.pm?
Hi Michael On Mon, 2010-07-26 at 10:17 -0400, Michael Peters wrote: On 07/26/2010 08:51 AM, Jason Purdy wrote: After giving Brannigan a cursory glance, it looks pretty nice, but what does this offer that Data::FormValidator doesn't? From the opposite point of view, here are some things that Brannigan doesn't do that DFV does do and that I can't live without: [chops list of very good points] As always, different users have similar but different requirements. It's all a matter of what weighting factors you apply to those requirements... -- Ron Savage http://savage.net.au/ Ph: 0421 920 622 # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] Anyone tried param validation with Brannigan.pm?
Hi Folks Thinking more about this. One factor is that being a contractor means moving to different jobs, which means different data, which in turns means different users and their expectations. So, it's good to be familiar with a range of validators, so as to be able to tailor the output to those users' requirements. For instance, one job (of mine) was radar results from firing the radar into the ground from an aeroplane (mining context), taken from Star Wars technology for firing radar into the sea, looking for Russian subs. In both cases, the aim is to detect a lump of metal. Another job was the configuration data of 15,000 network routers. Clearly, the users change just as the data changes. So, the nature of the output (eg error msgs) must change too. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622 # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####